It is a bug, but I'm not sure what's causing it. Running it through the debugger, when it finally gets to the (.+) part, it seems to be under the impression that it can only match one character. Changing the first half of the regex fixes this problem, but the fact is the bug remains.
Update: By the way, I came up with a way to use split() for this kind of problem -- splitting on a pattern unless you're inside quotes (or the like). It's ugly, and probably not fit for production, but here it is:
while (<DATA>) {
chomp;
my $q = 0;
# documented for the faint of heart
my @fields = split m{
' # if we match a '
(?{ $q = !$q }) # toggle $q
(?!) # and fail (don't split here)
| # OR
XX # if we match XX
(?(?{$q}) # and $q is true
(?!) # fail (don't split here)
) # otherwise it succeeds and splits
}x;
print "[", join("][", @fields), "]\n";
}
Try that on your data. It's sick.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.