The main trick is to use () inside the regex used in split to capture the delimiters.$a=q{<tag ref=1>Start<tag ref=2>and more</tag>and end</tag>}; @l=split qr{(</?tag[^>]*>)}, $a; print join "\n", @l;
In reply to Re: Split tags and words nicely
by themage
in thread Split tags and words nicely
by bwgoudey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |