http://www.perlmonks.org?node_id=1013181


in reply to regex related...search 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";
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

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