multiple delimiters

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
obfusc88
Posts: 8
Joined: Mon Dec 18, 2006 8:50 pm

multiple delimiters

Post by obfusc88 »

This is a typical sample line showing sometimes a comma/space as delimiter, sometimes in double quotes, not always. Different patterns may change position on each line.

Sample line:
"this is a good piece" "abc" , "5" "66",7

Looking to get these values selected from the line:
1= "this is a good piece"
2= "abc"
3= "5"
4= "66"
5= 7

Maybe it needs multiple RegEx passes vs. 1? Maybe put spaces around the commas, then select everything separated by (spaces that are not inside double quotes)?

Want to do a RegEx to select all of these values. Can this be done using different RegEx separated with "|" ?
Can this be done to take everything inside double quotes and everything between comma/space if not inside double quotes?

Can this be done with normal Perl RegEx syntax vs. TextPad syntax? If I see a working Perl version, I may be able to work with that. How to look for all between double quotes, but not greedy, so the first value is selected vs. most of the entire line?

I have tried various RegEx things like these, but none came close:
".*"[?= ]
^.*[^ "]?[?= ]
^.*[^ "][?= ]|".*"[?= ]
".*[^,]
"[\w+]|[\w+\s*\w+]"
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

([^ ,]+|"[^"]*")[ ,]+([^ ,]+|"[^"]*")[ ,]+([^ ,]+|"[^"]*")[ ,]+([^ ,]+|"[^"]*")[ ,]+([^ ,]+|"[^"]*")
Post Reply