|
2005-02-04
| ||
| 17:26 | • Closed ticket [1116050fff]: Regexp backreference fail with a * closure plus ... artifact: 1d208ce45b user: dkf | |
| 09:27 | • New ticket [1116050fff]. artifact: 9c366e9ceb user: jkbonfield | |
Regexp backreference fail with a * closure
Closed / Duplicate1116050fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2005-02-04 09:27:58
The documentation has an example:
"([bc])\1 matches bb or cc but not `bc'". So I tried:
% regexp {^([bc])\1$} bb
1
% regexp {^([bc])\1$} cc
1
% regexp {^([bc])\1$} bc
0
All well and good. But what if we want b* or c* but not
[bc]* (ie disallow bbcb). The obvious solution is \1*:
% regexp {^([bc])\1*$} bbb
1
% regexp {^([bc])\1*$} bcb
1
bcb should not match!
Oddly, using \1+ works (but means of course that "b" or
"c" solo does not match).
James
dkf Closed ticket [1116050fff].
[History diff]2005-02-04 17:26:24
Log in (anonymous is fine) to add a comment.