[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Foolish Perl Question
- Subject: [ale] Foolish Perl Question
- From: fletch at phydeaux.org (Fletch)
- Date: 22 Mar 2002 15:15:30 -0500
>>>>> "Bob" == Bob Kruger <krugerb at benning.army.mil> writes:
Bob> $line =~ s/\[font color \=red\]//g;
Actually the = doesn't need to be escaped.</pedantic>
Bob> What I would like to do is identify anything that starts with
Bob> "[font" , and strip everything until the next "]". So, if
Bob> the character "*" did that, it would look something like:
$foo =~ s/\[font(?:[^\]]+)\]//g;
Of course handling anything fancier (for something more like
HTML, where you could have quoted attributes or comments or . . .)
would require a parser rather than just a regexp.
See also the Text::Balanced and Regexp::Common modules on
CPAN, perldoc perlre, and perldoc -q 'remove HTML'.
Fletch | "If you find my answers frightening, __`'/|
fletch at phydeaux.org | Vincent, you should cease askin' \ o.O'
770 933-0600 x211(w) | scary questions." -- Jules =(___)=
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be
sent to listmaster at ale dot org.