in reply to Re: Split string only on regular expression match
in thread Split string only on regular expression match

As I explained above, I can't use an array, the search string comes one at a time, I have a typo on this line:
my @got = $search_c =~ /^(?!\w)|(\.[^.]+)$/ig ? [] : split //, $strin +g +_c;
It should be:
my @got = $string_c =~ /^(?!\w)|(\.[^.]+)$/ig ? [] : split //, $string +_c;
Thanks!

Replies are listed 'Best First'.
Re^3: Split string only on regular expression match
by Anonymous Monk on Oct 31, 2017 at 17:52 UTC
    I used a simpler regular expression to do what I want as:
    my @got = $string_c !~ /^\w+\s+\w+$/ig ? () : split /\s/, $string_c;