in reply to quote regular expression
The thing about the short string constraint is that you still want the regex engine to match and move past them even though you're not interested in processing them. That suggests you should perform the length check outside of the regex.while ($text =~ m/'(((\\')|[^'])*)'/g) { if (length($1) > 3) { ...do something... } }
Also, do you have to handle \\? If so, just modify the regex as follows:
while ($text =~ m/'(((\\['\\])|[^'])*)'/g) {
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: quote regular expression
by sadfaceman (Novice) on Jun 02, 2008 at 17:44 UTC |