Heres my go. It assumes that if a quote is used as a quote it won't be surrounded on both sides by an alpha char.

$_=<<END; 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. END #' my $accept=qr/(?: (?<![a-z]) (?: [''] (?:[^''\\]+|\\.)* [''] | [""] (?:[^""\\]+|\\.)* [""] ) (?![a-z]) | [^\\''"".]+ | [''""] )+/xi; my @parts; while (/($accept|([.][\r\n]*))/gxi) { push @parts,$1 unless $2; } print "part1: $_\n" for @parts; my @parts2=split / (?!$accept)([.][\r\n]*)/xi, $_; print "---\n"; print "part2: $_\n" for @parts; __END__ part1: this is some text part1: A period (".") usually terminates a statement part1: But not if it's quoted part1: Regardless of whether or not single quotes, '.', are used --- part2: this is some text part2: A period (".") usually terminates a statement part2: But not if it's quoted part2: Regardless of whether or not single quotes, '.', are used

Just in case anyone wonders, the [''] trick is harmless, perl just ignores dupes in a char class, but it keeps some syntax highlighting editors (like mine) from getting confused.

---
$world=~s/war/peace/g


In reply to Re: split $data, $unquoted_value; by demerphq
in thread split $data, $unquoted_value; by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.