A Regular Expression Bug
Several years ago, I specialized in Delphi software development.
Amongst several other endeavors, I wrote and sold a Regular Expression matcher. Well, it turns out that my matcher has a significant bug that was only just noticed by a user - handling of "$" to require a match to finish at the end of the line was broken.
Yikes!
For future reference of anyone consulting with Professor Google or Doctor Bing, here's the fix.
The code inside TniRegularExpressionMatcher.MatchExpression is missing a check for mfFinishOnly.
Inside the repeat loop:
if oState.Accept then begin
MatchFound(...);
Result := true;
if not bContinue then
break;
end;
This code needs to check for mfFinishOnly as follows:
if oState.Accept then begin
if not (mfFinishOnly in FxFlags)
or (iScan=Length(aString)) then
begin
MatchFound(...);
Result := true;
if not bContinue then
break;
end;
end;
In english: If mfFinishOnly is not specified, any match is acceptable; if we're at the end of the string, the match is always acceptable.

Recent comments
4 weeks 15 hours ago
4 weeks 21 hours ago
4 weeks 1 day ago
4 weeks 1 day ago
8 weeks 1 day ago
9 weeks 16 hours ago
9 weeks 4 days ago
9 weeks 4 days ago
11 weeks 5 days ago
12 weeks 3 hours ago