Sun 12 Jan 2014 10:14:29 PM UTC, comment #1:
This is a duplicate of bug #38149. See the discussion there for more information. I've done just about all of the work with Octave's regexp code for the last two releases, and unfortunately there are some incompatibilities that are not easy to fix without a full re-write/overhaul of the code. It is way more than I want to take on as a volunteer, although if we got it crowdfunded or there was a paying client it might be possible.
|
Sun 12 Jan 2014 09:00:15 PM UTC, original submission:
If a grouping construct is followed by '?', and that group is not matched, Octave does not return an entry for that token. MATLAB, however, returns an empty string.
At first I thought this is probably not important, and I've already fixed it in my code. Indeed, MATLAB's behavior might be considered wrong, since the empty string will in many cases not be a valid match.
But here's an example where I think the Octave behavior could be potentially problematic. In this case, the final grouping is returned as token #2 in Octave, and token #3 in MATLAB. It seems to me that MATLAB's behavior is better here. After all, is that second token returned by Octave from group 2 or group 3? To determine this, you would have to do additional tests.
Octave:
Matlab:
|