AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Regular Expression test

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5311

PostPosted: Mon Sep 16, 2013 9:38 am    Post subject: Regular Expression test Reply with quote

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*?".
Back to top
View user's profile Send private message Send e-mail
Drugmix



Joined: 08 Apr 2013
Posts: 392

PostPosted: Mon Sep 16, 2013 10:17 am    Post subject: Reply with quote

Hooray! Finally the greediness is controllable!
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1334
Location: Poland

PostPosted: Mon Sep 16, 2013 8:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5311

PostPosted: Tue Sep 17, 2013 6:54 pm    Post subject: Reply with quote

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"
Back to top
View user's profile Send private message Send e-mail
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5311

PostPosted: Wed Sep 18, 2013 5:06 am    Post subject: Reply with quote

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?".
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1334
Location: Poland

PostPosted: Sat Oct 12, 2013 12:24 pm    Post subject: Reply with quote

Instructor wrote:
single dot, like, ".*" or ".{5,10}" is non-greedy

And these:
[\d\D]*
[\s\S]*
[\w\W]*
are greedy?
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5311

PostPosted: Mon Oct 14, 2013 8:12 am    Post subject: Reply with quote

KDJ
Yes, but they are useless constructions, because AkelPad regular expressions greediness works consequentially.
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1334
Location: Poland

PostPosted: Sun Oct 20, 2013 6:22 pm    Post subject: Reply with quote

In test version, backward search (Shift+F3) does not work properly.
What: \w+
Text:
Code:
a, bc, def

Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5311

PostPosted: Mon Oct 21, 2013 5:56 am    Post subject: Reply with quote

KDJ
Test version
Back to top
View user's profile Send private message Send e-mail
KDJ



Joined: 06 Mar 2010
Posts: 1334
Location: Poland

PostPosted: Mon Oct 21, 2013 2:18 pm    Post subject: Reply with quote

Instructor
Now it works properly, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group