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

Re: REGEX problem with anchors

by mbethke (Hermit)
on Feb 05, 2013 at 06:50 UTC ( #1017073=note: print w/replies, xml ) Need Help??


in reply to REGEX problem with anchors

perl -E'say "OK" if "123dog"=~/\A\d+[a-z]+\z/' works for me. You're not using some stoneage Perl that didn't have \A, are you? Should have been there since before 5.8.

Replies are listed 'Best First'.
Re^2: REGEX problem with anchors
by live4tech (Sexton) on Feb 05, 2013 at 07:10 UTC

    Thanks for this, it lead to the answer!

    The one-liner worked for me as well and so I went back to my code (which I should have posted) and realized I forgot to chomp the input strings (the user was prompted to enter input strings and a regex). I chomped the regex, not the input strings. A novice mistake, I apologize!

      In case you are using Eclipse withe epic plugin as IDE for development you can check your regular expression with the RegExp View. Also, in case you got leading whitespaces or a linebrake at the end of your string - you can easily see in debug mode in the variables view. For me always a great help.

      ^_^

      Cheers!

      Tobias

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017073]
help
Chatterbox?
[Corion]: Basically I have this metadata and generating a purposeful example is much better if the output is ordered in the same way the documentation is ordered

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2017-01-16 12:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (149 votes). Check out past polls.