in reply to Re^2: Split with numbers
in thread Split with numbers

Use of split can be stretched for the case of xyz268 ...

split /([0-9]+)/ , $string , 3

... but still fails for the case of xyz.

Replies are listed 'Best First'.
Re^4: Split with numbers
by Laurent_R (Canon) on Nov 24, 2015 at 21:02 UTC
    Yes, you're right, I did not think that specifying a limit to 3 would work properly in this case, and it does, but, as you said, it still won't work in the case of ABC:
    $ perl -E ' say map { qq{"$_"\t}} split /(\d+)/, $_, 3 for qw[ AB23C +ABC23 23BC ABC ]' "AB" "23" "C" "ABC" "23" "" "" "23" "BC" "ABC"