in reply to Perl regular expression rules
The best way to validate your regex is to read the docs re regexen; perlre, perlretut, etc (and there's lots of etc inside perldoc, too) and use the knowledge acquired to refine your ability to understand the regex.
Second best, perhaps? Seek out a regex explanation utility of the sort frequently mentioned here.
Next best, try it. Test (brute force) a substantial subset or all the commands you're likely to use, in a dry run setting like:
#pseudocode my @commands=qw(ls rm rd cat....); for $command(@commands) { if ($command =~ /(your regex here)/ ) { say "regex matched $command"; } else { say "Oops! $command slipped by"; } }
|
---|
In Section
Seekers of Perl Wisdom