in reply to Curious Regex
sub stripCtrls { my $text = shift; #changed capture of $1 as per moritz $text =~ /(<\/Mil[^>]*>)([^\x9D]*)\x9D/; my $sStartTag = $1; my $sBetweenTags = $2; $sBetweenTags =~ s/[\x90\x8F]//g; return "$sStartTag$sBetweenTags\x9D"; }
which you can call like this stripCtrls($sTaggedText).
And if you don't need to preserve \x90 and \x8F in the start tag, maybe you might try the even simpler $text =~ s/[\x90\x8F]//g?Best, beth
Update: put in sub so can be used as one liner
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Curious Regex
by HamNRye (Monk) on Feb 11, 2009 at 18:39 UTC | |
by ELISHEVA (Prior) on Feb 11, 2009 at 18:48 UTC |