Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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];


Comment on Re: Perl regular expression
Download Code

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 chilling in the Monastery: (7)
As of 2014-07-10 01:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (198 votes), past polls