develooper Front page | perl.beginners | Postings from February 2002

Regular Expression Help

Thread Next
From:
David Mamanakis
Date:
February 5, 2002 18:11
Subject:
Regular Expression Help
Message ID:
01cb01c1aeb3$7500cbd0$de040e0a@avogadro.com
I am building a parsing routine, and am using a regular expression, which
works, EXCEPT when I need to EXCLUDE certain things...

i.e.
$right =~ s/A/X/g;

Basically, replacing A with X in the $right...

However, I may need to exclude this replacement in some of the values of
$right...

i.e.
Anything found between < and > SHOULD NOT be replaced.  \<.*\>
Anything found between & and ; SHOULD NOT be replaced.  \&.*\;
Anything found between {$ and } SHOULD NOT be replaced.  \{$.*\}
Anything found between < and = SHOULD NOT be replaced.  \<.*\=

How would I construct the Regular Expression to Replace A with X except
when A is found in the 4 scenarios listed?


--David Mamanakis



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About