Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Search and replace regex, but only retain a portion of the string

by choroba (Cardinal)
on Dec 22, 2018 at 23:11 UTC ( [id://1227621]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        $dest =~ s/\W+\[MSRN\]|\W+/_/g;
        $dest =~ s/_$//;
    
  2. or download this
        $dest =~ s/(?:\W+(?:MSRN\])?|\W+)(?(?=$)(?{$%=1})|(?{$%=0}))/$%?''
    +:'_'/ge;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found