in reply to Re^2: wrap abbreviations in XML element
in thread wrap abbreviations in XML element

As you will see, the separating whitespace is repeated after the "abbrev" element.

Yes, that's because of the behavior of split when there are multiple capturing groups present in the regular expression, that's why I wrote "don't include any capturing parens in this!". So if you change the capturing group in your regular expression into a non-capturing group, it'll work as expected: qr/a\.(?:!!!emsp14;|!!!hairsp;)A\./ See also perlretut.