in reply to Pattern matching problem

maybe this is what you need:
my $cn = qr/chapnum/; my $cp = qr/chapter/; $str1 =~ s#(1</$cn>\s*</$cp>\s*)<x>(<$cp>\s*<$cn>1A)#$1$2#s;

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.