go ahead... be a heretic | |
PerlMonks |
Curious Regexby HamNRye (Monk) |
on Feb 11, 2009 at 17:59 UTC ( [id://743119]=perlquestion: print w/replies, xml ) | Need Help?? |
HamNRye has asked for the wisdom of the Perl Monks concerning the following question: I'm certain this is old hat to many of the regs here, but I've been bustin' a synapse here trying to get this done. So, here's the idea... Translating info coming out of a legacy system to XHTML. There are control codes "\x90" "\x8F" that tell me useful things elsewhere in the text, but need to be excluded within certain tags. There could be any number of them within the tags. Here is some sample text:
Human readable instead of funky boxes...
My current regex looks like $text =~ s/(<\/Mil[^>]*>.*?)[\x90\x8F](.*?\x9D)/$1$2/ig; And this only removes the very first control character as expected. How can I create the regex so that between the open tag </Mil.*> and the close char \x9D I can remove any number of \x8F and \x90 characters? This all takes place in the middle of ~100 different transforms that need to be done to each file, so having this as a one-liner would be nice. Edit: Current regex updated to use [^>]* per Moritz's suggestion.
Back to
Seekers of Perl Wisdom
|
|