Page 1 of 1

Regular Expression test

Posted: Mon Sep 16, 2013 9:38 am
by Instructor
Test version of AkelPad.

Now all quantifiers are greedy (except for single dot, like, ".*" or ".{5,10}"). To make it non-greedy (old behaviour) use "?" after quantifier, like, "\d*?".

Posted: Mon Sep 16, 2013 10:17 am
by Drugmix
Hooray! Finally the greediness is controllable!

Posted: Mon Sep 16, 2013 8:04 pm
by KDJ
Text for test:
"abcabbbb"

RegExp:
"ab??b" - works
"ab*?b" - works
"ab+?b" - works
"ab{2,3}?b" - works

"ab?b" - works incorrectly, left "ab" not matches
"ab*b" - doesn't work
"ab+b" - doesn't work
"ab{2,3}b" - works

Posted: Tue Sep 17, 2013 6:54 pm
by Instructor
Test version

Now single dot, like, ".*" or ".{5,10}" is also greedy. AkelPad regular expressions greediness works is in the following way:
- Pattern "a.*b" in "aabbccaabbcc" matches "aabb" (not "aabbccaabb")
- Pattern "a.*?b" in "aabbccaabbcc" matches "aab"

Posted: Wed Sep 18, 2013 5:06 am
by Instructor
Test version

Returned back to the first variant (single dot, like, ".*" or ".{5,10}" is non-greedy). Second acquired unneeded slowdown.

AkelPad regular expressions greediness works consequentially:
- Pattern "ab?b" in "abc" has no matches, because "ab?" matches "ab" and next "b" has no match. Correct pattern will be "abb?".

Posted: Sat Oct 12, 2013 12:24 pm
by KDJ
Instructor wrote:single dot, like, ".*" or ".{5,10}" is non-greedy
And these:
[\d\D]*
[\s\S]*
[\w\W]*
are greedy?

Posted: Mon Oct 14, 2013 8:12 am
by Instructor
KDJ
Yes, but they are useless constructions, because AkelPad regular expressions greediness works consequentially.

Posted: Sun Oct 20, 2013 6:22 pm
by KDJ
In test version, backward search (Shift+F3) does not work properly.
What: \w+
Text:

Code: Select all

a, bc, def


Posted: Mon Oct 21, 2013 5:56 am
by Instructor

Posted: Mon Oct 21, 2013 2:18 pm
by KDJ
Instructor
Now it works properly, thanks.

Posted: Wed Oct 21, 2015 7:41 pm
by KDJ
Instructor
AkelPad ver. 4.9.7 dev (dated 2015-10-20), "Find" dialog.
Option ". matches \n" is working inversely, as ". not matches \n".

Posted: Thu Oct 22, 2015 7:01 am
by Instructor
KDJ
Corrected, thanks.

Posted: Sun May 22, 2016 8:40 pm
by KDJ
Instructor
AkelPad ver. 4.9.8 dev (2016-05-17), "Find" dialog.
What:

Code: Select all

(?s)^.+?$
Direction: "Down" or "Up".
If caret is at end of document, AkelPad crashes.

Posted: Mon May 23, 2016 7:34 am
by Instructor

Posted: Mon May 23, 2016 6:22 pm
by KDJ
Instructor
Now it works well, thank you very much.