Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Regex pattern that fails when string contains a certain pattern

by hoppfrosch (Scribe)
on Dec 22, 2016 at 09:47 UTC ( [id://1178347]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex pattern that fails when string contains a certain pattern
in thread Regex pattern that fails when string contains a certain pattern

Thanks!!!
You're right: my specification was incomplete.
Extended specification: Strings starting with a number should not be matched as well
  • Comment on Re^2: Regex pattern that fails when string contains a certain pattern

Replies are listed 'Best First'.
Re^3: Regex pattern that fails when string contains a certain pattern
by tybalt89 (Monsignor) on Dec 22, 2016 at 09:51 UTC
    #!/usr/bin/perl # http://perlmonks.org/?node_id=1178340 use strict; use warnings; while(<DATA>) { print /^(?!.*(?:-|_|^)\d)/ ? " matched $_" : "not matched $_"; } __DATA__ aa1.2 aa1_bb2 aa1_2 aa1_2bb 1aa

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found