- or download this
$str1='
<x><chapter>
...
<x><chapter>
<chapnum>1A</chapnum>
</chapter><x>';
- or download this
<x><chapter><chapnum>1</chapnum></chapter><x><chapter><chapnum>1A</cha
+pnum>
- or download this
<x><chapter><chapnum>1</chapnum></chapter><chapter><chapnum>1A</chapnu
+m>
- or download this
<x><chapter>
<chapnum>1</chapnum>
...
<x><chapter>
<chapnum>1A</chapnum>
</chapter><x>
- or download this
$s1='<x><chapter>\s*<chapnum>1</chapnum>';
$s2='<chapter>\s*<chapnum>1A</chapnum>';
$str1 =~s#($s1)(.*?)<x>?=($s2)#$1$2$3#gsi;