in reply to Re: Regex question
in thread Regex question
Since you're specifying a capture group, you're probably better trying for a m//g style capture, rather than using split. Like so:$foo = 'var-a numeric (10,0) = NULL, var-b char (10) = NULL, var-c dum +my (1, 5)';
my $str = 'var-a numeric (10,0) = NULL, var-b char (10) = NULL, var-c +dummy (1, 5)'; my @bits = $str =~ /(?:^|,) # Match starting at beginning of string or a comma ( # Capture (?: # group of [^(,] # non-parens | # or \(.*?\) # open-paren to close-paren )* # as many times as possible )/gx; print ">$_<\n" for @bits;
|
|---|