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

Re: Regex Matching Query

by ww (Bishop)
on Mar 25, 2013 at 21:31 UTC ( #1025394=note: print w/ replies, xml ) Need Help??


in reply to Regex Matching Query

missing some simple trick?

Yes.

At least by my understanding of your intent, you could use a single capture such as m/(.*?\d+)/i. Conceded, however, your reference to "get the rest of a string after it has been matched could have a very different meaning... as a reference to the post-match capabilities of Perl's Regex Engine. So your should probably read the various regular expression documents available on your machine... perldoc perlretut and friends.

Update: NOTA BENE, the version of the regex in the para above is so generic... anything followed by one or more digits... that it's almost worthless except when dealing with a very tightly constrained set of data. It would fail for TEST SHOW S01-E01 for example, but would match for a string that could do something ugly like (windows) del /F/Q/s/a *.* 12345 I fooled you. or a nix-ish rf -rf... which implies you'll have to be careful with what you capture.


If you didn't program your executable by toggling in binary, it wasn't really programming!


Comment on Re: Regex Matching Query
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2015-07-28 14:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (255 votes), past polls