in reply to Re^2: Possible to use "split", but save the delimiter?
in thread Possible to use "split", but save the delimiter?

This what you're after?

$s = qq|1-10,20 some.thing [[else]],bla bla bla|;; print "'$_'" for split /([-, .]|\[\[|\]\])/, $s;; '1' '-' '10' ',' '20' ' ' 'some' '.' 'thing' ' ' '' '[[' 'else' ']]' '' ',' 'bla' ' ' 'bla' ' ' 'bla'

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^4: Possible to use "split", but save the delimiter?
by ultranerds (Hermit) on Feb 10, 2010 at 17:38 UTC
    Thanks - works a charm <G>