TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Negative RegExp not working

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Mon Jul 31, 2017 2:58 pm    Post subject: Negative RegExp not working Reply with quote

I actually don't know if the feature is only not working or just missing (in that case consider it as a feature request Smile), but I can't find info on it in the forum...

This is not working, it shouldn't match strings with "FOO"
Code:

#action {{(?!FOO)}} {#echo CAPTURED};#showme {FOO};#showme {BAR}
#OK. {{(?!FOO)}} NOW TRIGGERS {#echo CAPTURED} @ {5}.
CAPTURED
FOO
CAPTURED
BAR


This instead is working, it matches only "FOO"
Code:

#action {{(?=FOO)}} {#echo CAPTURED};#showme {FOO};#showme {BAR}
#OK. {{(?=FOO)}} NOW TRIGGERS {#echo CAPTURED} @ {5}.
CAPTURED
FOO
BAR
Back to top
View user's profile Send private message
PowerGod



Joined: 04 Aug 2014
Posts: 339

PostPosted: Tue Aug 01, 2017 3:16 pm    Post subject: Reply with quote

I had a deeper look at the PCRE implementation and found out that this different approach seems working:
Code:

#action {{^.*FOO.*(*SKIP)(*FAIL)|^.*}} {#echo CAPTURED};#showme {FOO};#showme {BAR}
#OK. {{^.*FOO.*(*SKIP)(*FAIL)|^.*}} NOW TRIGGERS {#echo CAPTURED} @ {5}.
FOO
CAPTURED
BAR


...but still I wonder why (?!word) seems not working

EDIT:

Damn... in the end it is working... the ^ at the beginning did the trick !!

Code:

#action {{^(?!FOO)}} {#echo CAPTURED};#showme {FOO};#showme {BAR}
#OK. {{^(?!FOO)}} NOW TRIGGERS {#echo CAPTURED} @ {5}.
FOO
CAPTURED
BAR
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Wed Aug 02, 2017 6:15 pm    Post subject: Reply with quote

Weird that ^ is required, it's a PCRE thing though, not something I can control.

The following is valid as well.

Code:

#act {^{{?!FOO}}}
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group