Overlapping Regexps
Bill Denney
bill at denney.ws
Sun Mar 30 11:26:27 CDT 2008
When running the following,
frag = {"MGTGGR" "R" "GAAAAPLLVAVAALLLGAAGHLYPGEVCPGMDIR" "NNLTR" \
"LHELENCSVIEGHLQILLMFK" "TRPEDFR" "DLSFPK" "LIMITDYLLLFR" \
"VYGLESLK" "DLFPNLTVIR"};
seq = strcat (frag{:});
cuts = regexp (seq, '[KR][^P]');
the result is
cuts = [6 41 46 67 74 80 92 100],
but I expect for cuts to also find 7. In other words, I expected
cuts = [6 7 41 46 67 74 80 92 100].
On a related note, if there is overlap in matches, is there a way to
make regexp return the overlapping matches? For example:
a = "ababababab"
b = regexp (a, "aba")
returns b = [1 5] when I would like for it to return b = [1 3 5 7].
Is this a bug in my understanding of regexp or in regexp?
Thanks,
Bill
More information about the Help-octave
mailing list