Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: regex square brackets exceptions

by ww (Archbishop)
on Jun 22, 2011 at 00:40 UTC ( [id://910835]=note: print w/replies, xml ) Need Help??


in reply to regex square brackets exceptions

Are these acceptably comparable?

They don't use a single bit of syntax, of course, but it's not clear to me from your question if you're seeking syntax or simply an method to exclude characters.

perl -e "use 5.012; my $foo='now is the time for'; if ( $foo =~ /[meit +]+/ && $foo =~ /[^a]{1,20}/ ) { say 'true';} else {say 'nope';}" true

Similarly, not a single phrase, but...

perl -e "use 5.012; my $bar = 'abcdefg'; if ($bar =~ /[a-d]/ && $ bar +!~ /[ef]/ ){ say 'true';} else {say 'false';}" false

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-03-28 10:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found