[Issue 9979] Regex bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 23 13:25:40 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9979


Dmitry Olshansky <dmitry.olsh at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh at gmail.com


--- Comment #3 from Dmitry Olshansky <dmitry.olsh at gmail.com> 2013-04-23 13:25:38 PDT ---
(In reply to comment #2)
> I've tracked it down to a flaw in the algorithm:
[snip]

Yes, that's how it's working... 

> 
> The problem occurs when at the end of the string because the input stream
> position stops before going past the end.
> 
> Input stream position and read position:
> AB|
> 
> In this case the two characters should be "B" and <end of string>, but because
> BackLooper reads one character further back the two characters are "A" and <end
> of string> missing out B entirely.
> 
> This error propagates out in the form of matching a string of zero length.
> 
> The most sensible way of fixing this would seem to be to fix the off-by-one
> error in BackLooper, and make it use the read position rather than the input
> stream position as a base.

Nice analysis. Never liked the way this part of it was implemented...
Since you went that far you can just go ahead 
and prepare a pull request with a fix :)
Alternatively I'll get myself busy with it in a couple of days.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list