Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How do I match a string that is NOT at the end of a line?

by Laurent_R (Canon)
on Jun 29, 2015 at 17:52 UTC ( [id://1132504]=note: print w/replies, xml ) Need Help??


in reply to How do I match a string that is NOT at the end of a line?

Perhaps it is sufficient to just add the  . metacharacter at the end of your pattern:
$ perl -e ' print "matched" if "perlmonk" =~ /monk./;' ~ $ perl -e ' print "matched" if "perlmonks" =~ /monk./;' matched
Update: I had not seen that hippo has already suggested this solution. Sorry for duplicating it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 10:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found