in reply to A Regex to identify Regex's / Compiling a regex
$constraint =~ m@ ^\s* # skip all whitespace at beginning ( # start capturing /.+/ # match a '/' any number of anycha +r '/' | # or m # char 'm' (start of a match) (.) # capture the delimiter .+ # skip all the stuff \2 # upto the second occurance of the + delimiter ) #end capture [cgimosx]* # match zero or more match options \s*$ # skip white space @x
Basically, the regex validates regex of either /????/ or m/?????/cgimosx form.
I think your problem is that when the \ is at the end, it is escaping the the final forward slash and that won't match the regex validating regex. Try using the m!! form with a different delimiter. Should help.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: A Regex to identify Regex's / Compiling a regex
by knowmad (Monk) on Sep 19, 2002 at 22:01 UTC | |
by bart (Canon) on Sep 19, 2002 at 22:41 UTC | |
by BrowserUk (Patriarch) on Sep 19, 2002 at 22:47 UTC |