#!/usr/bin/perl -nl use strict; my($i,$t); $t="[tag1]This is plain text.More text.[tag2]And more text."; my @fields=split /((?:<[^>]+>|\[[^]]+])+)/, $t; shift @fields if $fields[0] eq ''; print for @fields; exit;