Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Simple regexp question

by l.frankline (Hermit)
on Mar 31, 2006 at 06:25 UTC ( [id://540379]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Simple regexp question
in thread Simple regexp question

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^4: Simple regexp question
by ikegami (Patriarch) on Mar 31, 2006 at 07:15 UTC

    Test before contradicting someone.

    print('*' =~ /^[*]$/ ? 'match' : 'no match', "\n"); # match print(']' =~ /^[*]$/ ? 'match' : 'no match', "\n"); # no match print('' =~ /^[*]$/ ? 'match' : 'no match', "\n"); # no match

    Only \, ^ (depending on position), - (depending on position), ], the sequence [:...:] and the regexp delimiter are special in character classes.

      I'd add

      perl -e "print (';' =~ /[];]/ ?'match':'nomatch');" prints "match"

      the ] is also depending on position

      update: fixed typo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found