in reply to Re: Parsing a line of text items
in thread Parsing a line of text items

Just for fun:

This seems to work if the input is surrounded by exactly one whitespace, but don't try to escape doublequotes

DB<89> p "'$_'" ' 23 45.67 "John Marcus" Surname 23 45.67 "John Marcus" Surname ext +ra ' DB<90> say "'$3'" while /\s*(\s)("?)(.*?)\2(?=\1)/g '23' '45.67' 'John Marcus' 'Surname' '23' '45.67' 'John Marcus' 'Surname' 'extra' DB<91>

For testing I'd suggest to automatically create strings for random input. Like this you can cover a large set of cases.

NB: here are still dragons.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery