in reply to Capturing text between literal string delimiters (was: Regular expressions)

although your example result doesn't demonstrate this behavior, i think this is what you want:
@array = split(/\s*sp\s*/, $string);
Update: well now that i think about it, that probably isn't want you want at all (it will match sp's that occur inside words). sp probably isn't be best delimiter in the world...

Replies are listed 'Best First'.
Re: Re: Regular expressions
by joealba (Hermit) on Jun 24, 2002 at 13:49 UTC
    Split will work fine, but you have to do some funny schtuff. my @strings = map {/\w/ ? /^\s*(.*?)\s*$/ : ()} split /\bsp\b/, $string;