("[^"]*")
Finding little Snip-its like above is why I like to come look thru these
grep treads. They completely show me how I'm thinking of the problem all
wrong. Brilliant!
Thanks!
On Sunday, October 13, 2019 at 7:15:35 AM UTC-4, GP wrote:
>
> You don't need to do it in two steps. The following pattern captures in
> groups everything but commas in non-quoted strings:
>
>
> ^(\d{2}\s[A-Z]{3}\s\d{4}),(\d{2}\s[A-Z]{3}\s\d{4}),("[^"]*"),([^,]*),(\d{1,}\.\d{2}),(\d{1,}\.\d{2})$
>
> then do the substitution with the captured groups separated by tab
> characters.
>
> $1\t$2\t$3\t$4\t$5\t$6
>
> This assumes each entry is formatted like your example.
>
> The ("[^"]*") pattern is what captures the quoted string with embedded
> commas.
>
> The ([^,]*) pattern handles your example's empty field but can handle a
> non-empty field in that position as long as it doesn't have an embedded
> comma.
>
> You may have to do some tweaking on the date and dollar capturing patterns
> if your statements have some variations in their formats.
>
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/8e0534e3-1893-4abd-bfad-02adadc8ef0e%40googlegroups.com.