in reply to Curios use of regular expressions in split
I don't know if anybody has a better solution, but you could just take two steps to both capture what you want to capture and split the string:
my $string = "uno abc dos"; my @a = split /abc/, $string; $string =~ /(abc)/; ...some use of $1...
If your pattern is just something as trivial as abc, you could just assume $1 = 'abc'...but I'm assuming it's not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Curios use of regular expressions in split
by Anonymous Monk on Feb 15, 2012 at 17:45 UTC | |
|
Re^2: Curios use of regular expressions in split
by juliosergio (Sexton) on Feb 15, 2012 at 18:55 UTC |