Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Regex: If not beginning of string match end

by 2teez (Priest)
on Jan 17, 2013 at 17:24 UTC ( #1013827=note: print w/ replies, xml ) Need Help??


in reply to Regex: If not beginning of string match end

Really, I don't know how your data looks like or how you are getting it..
However, does something like this work for you:

use strict; use warnings; while(<DATA>){ chomp; print $_,$/ if /\d{2}$/; } __DATA__ PHY/99/3006 PHY/99/3009 PHY/99/2678 PHY/99/390O PHY/99/129R PHY/99/UY90
Update
Output:
PHY/99/3006 PHY/99/3009 PHY/99/2678 PHY/99/UY90

You can also check this Simple word matching

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: Regex: If not beginning of string match end
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2015-07-07 06:46 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 (87 votes), past polls