Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Perl regular expression rules

by ww (Archbishop)
on Dec 06, 2012 at 00:39 UTC ( #1007440=note: print w/replies, xml ) Need Help??

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"; } }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007440]
[stevieb]: cheers beech. twas totally my mistake, and I got bit. When things work for so long without issue, one becomes complacent (ie. replace we/one with I ;) I've been copy/pasting that around for a few years without a hiccup, so when...
[stevieb]: choroba pointed that out, I was just, you know, *sigh*. In effect, I was lucky and fortunate

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-07-25 23:33 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (383 votes). Check out past polls.