If you're working with XML, then you should consider using a cpan module like XML::Simple instead of hacking together a regex.
use Data::Dumper; use XML::Simple; use strict; my $xml = '<funcCall> <funcName>write</funcName> <rhsValue>crlf</rhsValue> <symConstant>loading</symConstant> <symConstant>| |</symConstant> <symConstant>lemmas</symConstant> <symConstant>| |</symConstant> <symConstant>for</symConstant> <symConstant>| |</symConstant> <variable><lx></variable> <symConstant>| |</symConstant> <symConstant>onto</symConstant> <symConstant>| |</symConstant> <variable><lms></variable> </funcCall>'; my $ref = XMLin($xml); print Dumper($ref);
In reply to Re: regex replace using position loop
by wind
in thread regex replace using position loop
by nglenn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |