You can rely on some properties of regular expression matching to make this much simpler than what I've seen so far (unless I'm missing something, of course).
Look for a " followed by whatever until you hit " or | or end of line. If you hit ", then you found a matched pair so leave the " in. If you don't, then replace the " with a space. The "g" modifier on the regex then starts where the last match left off. This means you don't need to worry about starting a match at the second " of a matched pair. - tye (but my friends call me "Tye")s#"([^|"]*)([|"]|$)# ( $2 eq '"' ? '"' : ' ' ) . $1 . $2 #ge;
In reply to (tye)Re: Delete unmatched quotes from a delimited file?
by tye
in thread Delete unmatched quotes from a delimited file?
by Buckaroo Buddha
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |