http://www.perlmonks.org?node_id=255527


in reply to find, then store functions into array problem

To extract the strings that are not + or -,

my @remaining = grep {defined} split /[+-]{2,}/, $righteq; # fixed 2nd arg error

I assume you don't mean for these functions to be in perl, since your ^ appears to be exponentiation.

A more detailed regex for your special case can be constructed. Left as an exercise for the reader.

Update: Ok, using your regex:

my @remaining = grep {defined} split / (e\^\(t\+-(\d+\.?\d*|\.\d+)\)) # the special, captured | # or else [+-]+ # filler, not captured /x, $righteq;

After Compline,
Zaxo