If I feed either aaa"bbb" or "aaa"bbb to your initial match,
$1 is respectively aaa or "aaa" and $2 is empty. Can you give an example of what your regexp does?
chas
(Update: Now copying and pasting your first regexp again it appears that in the cases I mentioned $1 is "bbb" or bbb and $2 is empty, but $` is aaa or "aaa".
Did your first regexp change? What is really confusing me is that if I set
@results=m/([^"']+|(?:"(?:[^"]|\\")*"))/g
for the cases I mentioned, I do get aaa and "bbb" (or "aaa" and bbb.) I don't see why the match operator doesn't seem to return $1 and $2. Perhaps I should give up for the day...)
(Update2: To be explicit about what I mean - I ran the script:
$_=<>;
chomp;
@results=m/([^"']+|(?:"(?:[^"]|\\")*"))/g;
print "$results[0], $results[1]\n";
print "$1, $2\n";
print "$`, $1, $2\n";
and entered aaa"bbb". The result was:
aaa, "bbb"
"bbb",
aaa, "bbb",
Seems bizarre to me, but perhaps I'm missing something obvious.