Date: 26 Sep 2001 01:41:41 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Pattern Matching
Message-Id: <slrn9r2ce1.cr1.damian@puma.qimr.edu.au>

On Tue, 25 Sep 2001 19:36:20 -0600, phookie said:
>How would one match/sub a string which begins with a "<" with zero or
>more"<", ">" alphanumerics, quotes, equal signs, period, commas,
>semi-colons, underscores, forward "/" and back "\" slashes, white space,
>etc and ends with a ">" character.
>This does not appear to work
>
>   $mystring =~ s/^<[A-Z a-z 0-9 "=.,;_/\\\s].+>$/my_new_string/;
>

It looks like you are trying to parse html. While it may seem like
you could do it with simple pattern matching, this is not in fact the
case. You need a fully fledged parser.

See perlfaq9: How do I remove HTML from a string?
(type 'perldoc -q html' at the command prompt).

This FAQ contains a few tips that you will find valuable, even if
Ihave misread the above and you are trying to parse something other
than html.

HTH

Cheers,
Damian
-- 
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/}  __END__
Just another Perl Hacker,### http://home.pacific.net.au/~djames.hub


