- labels: plugin, regex --> regex, regex-testbed
- status: open --> applied
- assigned_to: Teodor Petrov
The Regular Expression Testbed plugin skips empty matches that are perfectly valid, so it looks like there were less matches than expected. See Volker Meyer comment in ticket 1120:
I have regex, that get me the indent part of a string "^( *)Something([a-z]+)".
PCRE decreases the number of matches when the indent part is empty. So the "([a-z]+)" part is sometimes GetMatch(1), sometimes GetMatch(2),
It is not related to PCRE but to this line in regexdlg.cpp:
if (!m_wxre.GetMatch(text, i).IsEmpty())
ret.Add(m_wxre.GetMatch(text, i));
The attached patch fixes the following:
* Fix plugin output keeping the empty matches
* Test regex validity always, not only when the test string is not empty
* Prepares the plugin for wxWidgets 3.1.6, removing the Advanced line in the choice (in 3.1.6 it will be a synonym of Extended)
* Some refactoring for easier to read code