Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001082Documentation, Examples, and Web SiteWriting with Informpublic2013-02-24 12:142014-05-07 07:38
Assigned Tograham 
Platformx86OSWindowsOS VersionXP
Product Version6G60 
Target VersionFixed in Version6L02 
Summary0001082: Match given for regular expression is incorrect.
Description"19.6. Regular expression matching" says this.

"This condition is true if any contiguous part of the text can be matched against the given regular expression. Examples:

if "taramasalata" matches the regular expression "a.*l", ...

is true, since this looks for a part of "taramasalata" which begins with "a", continues with any number of characters, and finishes with "l"; so it matches "asal". The option "case insensitively" causes lower and upper case letters to be treated as equivalent.".

However, the regular expression doesn't match "asal", it matches "aramasal".
Minimal Source Text To Reproduce

After looking:
if "taramasalata" matches the regular expression "a.*l", say the text matching regular 
say line break.

The Testing Room is A Room.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
zarf (developer)
2013-02-24 14:11

Confirmed. (The code's behavior is correct, because .* is a greedy match, as noted later.)
zarf (developer)
2013-02-24 14:17

Just to be clear: changing the pattern to "a.*?l" -- the non-greedy version -- does not change the result. This is still correct, because matches go from left to right. Once you match the first "a", there's only one way to reach the "l".

(This confused me at first, but it's the way Perl works.)

- Issue History
Date Modified Username Field Change
2013-02-24 12:14 climbingstars New Issue
2013-02-24 14:11 zarf Note Added: 0001983
2013-02-24 14:11 zarf Assigned To => graham
2013-02-24 14:11 zarf Status new => confirmed
2013-02-24 14:17 zarf Note Added: 0001984
2014-01-25 09:28 graham Status confirmed => resolved
2014-01-25 09:28 graham Resolution open => fixed
2014-05-07 07:37 jmcgrew Fixed in Version => 6L02
2014-05-07 07:38 jmcgrew Status resolved => closed

Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker