Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Perl regular expression

by JavaFan (Canon)
on Apr 30, 2012 at 16:06 UTC ( #968106=note: print w/replies, xml ) Need Help??


in reply to Perl regular expression

A couple of ways:
$str =~ s/589HC-CG26G-133578.*/589HC-CG26G-133578/; $str =~ s/589HC-CG26G-133578\K.*//; $str =~ s/(589HC-CG26G-133578).*/$1/; ($str) = $str =~ /(.*589HC-CG26G-133578)/; ($str) = $str =~ /.*589HC-CG26G-133578/g; $str = substr($str, 0, index($str, "589HC-CG26G-133578") + length("589 +HC-CG26G-133578")); substr($str, index($str, "589HC-CG26G-133578") + length("589HC-CG26G-1 +33578"), -1) = ""; $str = join "", (split /(589HC-CG26G-133578)/, $str)[0, 1];

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2016-09-30 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (570 votes). Check out past polls.