Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: regex logical equivalence?

by Sol-Invictus (Scribe)
on Feb 05, 2004 at 08:48 UTC ( #326723=note: print w/ replies, xml ) Need Help??


in reply to regex logical equivalence?

From your other node you should appreciate the need for readability in regex. The guy that wrote the original regex didn't think much about readability at all.

there are a couple of things you can do as well as using \X, like:

different delimiters

in a regex with a couple of escapes like this /\@\\\// you can change the /../delimiters to any character you want, as long as they are paired, like this !\@\\\/! or #\@\\\/#

block quoting

in a regex with lots of escaped characters use \Q...\E notation. This works in the same way that single quotes work for strings, meaning the characters are interpeted exactly as they are written - !\Q$@.\^[{\E! is more readable than !\$\@\.\\\^\[\{!

<lecture mode = on>

Finally as others have already pointed out, Perl's regex are very powerful and as such difficult to "just pick up", you have to read up on regex to even begin to understand how to use them - as a beginner you should probably read these first:

perlrequick Perl regular expressions quick start perlretut Perl regular expressions tutorial perlfaq6 Regexes
</lecture mode>

----Signature: You spend twenty years learning the spell that makes nude virgins appear in your bedroom, and then you're so poisoned by quicksilver fumes and half-blind from reading old grimoires that you can't remember what happens next.


Comment on Re: regex logical equivalence?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://326723]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2014-08-20 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (118 votes), past polls