in reply to Split with numbers
Like this?
#! perl -slw use strict; my @examples = qw[ AB23C ABC23 23BC ABC ]; m[([A-Z]*)([0-9]*)([A-Z]*)] and printf "%s: '%s', '%s', '%s'\n", $_, $1//'', $2//'', $3//'' for @examples; __END__ C:\test>1148522 AB23C: 'AB', '23', 'C' ABC23: 'ABC', '23', '' 23BC: '', '23', 'BC' ABC: 'ABC', '', ''
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Split with numbers
by muba (Priest) on Nov 24, 2015 at 19:26 UTC | |
by BrowserUk (Patriarch) on Nov 24, 2015 at 19:33 UTC | |
by muba (Priest) on Nov 24, 2015 at 20:54 UTC |