Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^7: Regex Help

by AnomalousMonk (Abbot)
on Mar 25, 2013 at 19:00 UTC ( #1025366=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Regex Help
in thread Regex Help

He mentioned in his OP the following separators: .-:. That being the case, the character class would be [.:-].

gautamparimoo:
davido is absolutely right, but as you are apparently a regex tyro, it is prudent to mention a major pitfall lurking here.

The  '-' character is special in a character class: it denotes a range of characters. Taken in its originally stated order,  [.-:] would match all characters in the range from '.' to ':' inclusive, which includes all decimal digits and '/' (assuming the ASCII character set). To unmajick the '-' in a character class, put it as the first or last character, or escape it:
    [-.:]  [.:-]  [.\-:]
See perlre, perlrequick (esp. Using character classes), and perlrecharclass (esp. Bracketed Character Classes, Special Characters Inside a Bracketed Character Class, Character Ranges and Negation).


Comment on Re^7: Regex Help
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2015-07-28 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (257 votes), past polls