slugger415 has asked for the wisdom of the Perl Monks concerning the following question:
Might be a dumb question, but is there a module or some easy method to parse pipe-delimited text strings that might actually contain a pipe character?
Yes it's easy to use split to split up a string, but my text contains some real pipe characters. It uses the Excel-type formatting where double-quotes surround the whole string that contains the pipe text, e.g.
"A bunch of pipes: ||| right here"|next column|last column
I can bend my brain trying to do this with regex's but then I'd have to account for other characters such as double quotes, and I'm betting someone has figured this out already. I know CSV parsers can handle this sort of thing, maybe there's a CSV parser that allows different delimiters?
thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing pipe-delimited text that contains pipes
by AnomalousMonk (Archbishop) on Aug 10, 2019 at 00:38 UTC | |
|
Re: Parsing pipe-delimited text that contains pipes
by soonix (Chancellor) on Aug 10, 2019 at 12:32 UTC | |
|
Re: Parsing pipe-delimited text that contains pipes
by karlgoethebier (Abbot) on Aug 10, 2019 at 12:41 UTC | |
|
Re: Parsing pipe-delimited text that contains pipes
by daxim (Curate) on Aug 10, 2019 at 07:10 UTC | |
|
Re: Parsing pipe-delimited text that contains pipes
by slugger415 (Monk) on Aug 12, 2019 at 18:49 UTC | |
by haukex (Archbishop) on Aug 12, 2019 at 19:00 UTC | |
by slugger415 (Monk) on Aug 12, 2019 at 19:47 UTC | |
|
Re: Parsing pipe-delimited text that contains pipes
by slugger415 (Monk) on Aug 12, 2019 at 17:55 UTC |