in reply to Why would one want in a regex a class with only a single entry?
One justification I have heard people make (not that I subscribe to the idea myself) is that one doesn't have to worry so much about meta-characters, in that nearly every single character loses its meta function in a character class.
Instead of having to write /a\+b/, one can write /a[+]b/. Thus, instead of having to worry about whether a punctuation character needs to be escaped or not, one can stick it in a character class and be done with it.
I think this is a false economy, but, if it makes you happy...
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why would one want in a regex a class with only a single entry?
by davido (Cardinal) on Mar 26, 2008 at 05:32 UTC | |
|
Re^2: Why would one want in a regex a class with only a single entry?
by ack (Deacon) on Mar 26, 2008 at 04:27 UTC |