JohnRuf has asked for the wisdom of the Perl Monks concerning the following question:
I've patterned this after the example in the docs of parsing CSV text. Any clues why the regexp portion does not seem to do what the docs say?print "ps before=$param_string\n"; my @ef = (extract_multiple($param_string, [ sub { extract_delimited($_[0]) }, sub { extract_bracketed($_[0]) }, sub { extract_variable($_[0]) }, qr/([^,]+)(.*)/, ], undef,1)); print "extracted=@ef\n\n"; Results: ps before=0.0, 0.0, 0.0, @inches, 0.0, 0.0, [0.0,0.0,'PI$pxtr19i'] extracted=0.0 ps before=0.0,0.0,0.0,@inches,0.0,0.0,[0.0,0.0,'PI$pxtr19i'] extracted=0.0 ps before= "TERMINAL_DRILL_SIZE", "", , @scale , , [0.034, 0.0] extracted="TERMINAL_DRILL_SIZE" "" If I remove the regexp match like this: my @ef = (extract_multiple($param_string, [ sub { extract_delimited($_[0]) }, sub { extract_bracketed($_[0]) }, sub { extract_variable($_[0]) }, #qr/([^,]+)(.*)/, ], undef,1)); then the results are: ps before=0.0, 0.0, 0.0, @inches, 0.0, 0.0, [0.0,0.0,'PI$pxtr19i'] extracted=@inches [0.0,0.0,'PI$pxtr19i'] ps before=0.0,0.0,0.0,@inches,0.0,0.0,[0.0,0.0,'PI$pxtr19i'] extracted=@inches [0.0,0.0,'PI$pxtr19i'] ps before= "TERMINAL_DRILL_SIZE", "", , @scale , , [0.034, 0.0] extracted="TERMINAL_DRILL_SIZE" "" @scale [0.034, 0.0]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text::Balanced extract_multiple does not return all values
by JohnRuf (Initiate) on Aug 29, 2003 at 22:23 UTC |