Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
while (<>){ # grab: ween{(commands)} if (/^ween\s*\{{1}\s*(.*\;){1}\s*\}{1}$/){ $cmd = $1; # avoid: .!+=[]*<>$%@?&:/\{} command in syntax if ( $cmd=~/[.\!\+=\[\]\*<>\$\%\@\?\&:\/\\\{\}]/g){ print "$0:Found illegal character!\n"; } else { print "$cmd\n"; } } else { print "$0:Incorrect Syntax!!\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex optimization
by Hofmator (Curate) on Aug 08, 2001 at 18:56 UTC | |
|
Re: regex optimization
by Anonymous Monk on Aug 08, 2001 at 18:54 UTC | |
|
Re: regex optimization
by tachyon (Chancellor) on Aug 08, 2001 at 19:06 UTC |