Bug #18990 2013-05-04 01:22

kaslai

Regular Expression "\d*\ returns 0 length result

The RegEx engine matches \d* to a 0-length string, even on lines containing numbers.

This is a failing of the regular expression engine because regular expressions are supposed to be greedy.

I'm using a build of SVN 8438 and if you try to search for it in your project files, the application will attempt to compile an infinitely long list of empty results. This locks the application up. It's not a huge issue, but it would be nice to see this fixed.

Related: [ Bug #17195 ] Search all files for regex "^" freezes IDE

This is another case of a 0 length RegEx result tying up the application.

Possible bandaid: Before searching through files for a given Regular Expression, check and see if it results in a 0-length string. If it does, abort.

Category
Application::Editor
Group
Platform:Windows
Status
Closed
Close date
2013-05-11 12:16
Assigned to
biplab
biplab 2013-05-09 13:38

I have added a bandaid for [Bug #17195]. However I can't reproduce the first bug you mentioned. Can you give more details?

kaslai 2013-05-10 03:31

I have tried this in the latest SVN build of Code::Blocks, and the bug is still present. When searching for "\d*" a 0-length string is highlighted, even when a numeric answer is clearly there. While technically, * should match 0 or more of any character, RegEx is supposed to be greedy, so it should only return a 0-length string if no numbers are present.

Here is a screenshot of the search window: http://puu.sh/2Qmz5.png and I'm using the latest update of Windows 7.

Just to be clear, \d+ works as \d* SHOULD work, with the caveat that it doesn't match a 0 length string when a larger match is available if it were to do so.

biplab 2013-05-11 12:16

Sorry, but I can't reproduce. Any additional information? Does it

still persist?