in reply to Re^3: split on the pattern of '),('
in thread split on the pattern of '),('
No it doesn't. The string you give contains "),(" three times, and my regex splits it at all three.
use Test::More tests => 5; my $string = '(1,"(text),(text)", 123),(2,"(string)", 234),(...)'; my @parts = split m{ [)] [,] [(] }x, $string; # Prove that the split worked properly... # Firstly, joining the parts back with '),(' recreates the original st +ring. my $joined = join '),(', @parts; is($joined, $string); # Secondly, none of the individual parts contain '),(' unlike($_, qr{\Q),(\E}) for @parts; done_testing();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: split on the pattern of '),('
by ikegami (Patriarch) on Sep 30, 2012 at 05:41 UTC | |
by tobyink (Canon) on Sep 30, 2012 at 08:13 UTC | |
by ikegami (Patriarch) on Sep 30, 2012 at 22:05 UTC |