in reply to split $data, $unquoted_value;
A regex that catches common cases is fairly easy. However handling nasty nested cases with full stops that are not adjacent to a quote heads into CSV teritory. Here's the simple case with an example of not handling something a little nastier:
use warnings; use strict; my $str = do {local $/ = ''; <DATA>;}; print join "^", split /(?<!['"])\.(?!['"])/, $str; __DATA__ this is some text. A period (".") usually terminates a statement. But not if it's quoted. Regardless of whether or not single quotes, '.', are used. "Quoted sentences with a . in the middle." could be harder to manage h +owever.
Generates:
this is some text^ A period (".") usually terminates a statement^ But not if it's quoted^ Regardless of whether or not single quotes, '.', are used^ "Quoted sentences with a ^ in the middle." could be harder to manage h +owever
|
|---|