Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: regex and delete

by choroba (Canon)
on Jan 14, 2013 at 10:32 UTC ( #1013181=note: print w/ replies, xml ) Need Help??

in reply to regex and delete

You can use a simple substitution. [LW] is a character class containing both L and W, the final /g is needed to replace both the letters.

$string = "(L 2 W 7)"; $string =~ s/[LW] //g; # Replace L or W followed by a space by nothing +. print $string, "\n";
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re: regex and delete
Select or Download Code
Replies are listed 'Best First'.
Re^2: regex and delete
by freekngeek (Acolyte) on Jan 14, 2013 at 10:41 UTC
    Thanks a lot man. it's working :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-11-25 07:38 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (672 votes), past polls