Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Wed Oct 05, 2011 8:40 pm   

[3.34 bug] *s in string lists in trigger patterns
 
If you have (*) at the start of the first item in a string list, it will match nothing, as well as what it's supposed to match. For example:
Code:
^{(*) test}$ will match a blank line, as well as 'foobar test'


Note that it must be the first item in the string list:
Code:
^{foobar|(*) test}$ will NOT match blank lines


And it must be captured:
Code:
^{* test}$ will NOT match blank lines


Seems like a bug to me. Definitely the strangest one I've found though, I have no explanation for why it would do that.


Last edited by Daern on Thu Oct 06, 2011 3:40 am; edited 1 time in total
Reply with quote
ins0mnia
Novice


Joined: 23 Jan 2011
Posts: 42
Location: United States

PostPosted: Thu Oct 06, 2011 3:27 am   
 
Pattern matching

{val1|val2|val3|...} match any of the specified strings can not use other wildcard inside this
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Oct 06, 2011 3:31 am   
 
You completely missed the point. Firstly, if you "can not use other wildcard inside this", don't you think it's strange that these triggers ARE firing? Secondly, and more to the point, I have allow wildcards within {} trigger patterns turned on in prefs. FYI, I think I found the root of the pattern - it's in the conversion to regex. ^{(*) test}$ is being converted into ^(?:(.*) test)?$, it should be ^(?:(.*) test)$. The ? makes the entire block optional, which is making it match blank lines.
Reply with quote
ins0mnia
Novice


Joined: 23 Jan 2011
Posts: 42
Location: United States

PostPosted: Thu Oct 06, 2011 4:05 am   
 
Actually you missed the point. It's unsupported, thus not a bug.
If you have a pref checked to allow them, why would I find it strange that they fire?
If you use a debug pref, why would you be surprised by unexpected results?
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Oct 06, 2011 4:17 am   
 
Really? The 'Allow wildcards within {} trigger patterns' preference that's existed for years (even in zmud) is unsupported? That's news to me... And who said anything about a debug pref? I'm using no such thing. Trigger patterns with the sequence of characters {(*) in them are not correctly being converted to regex, they have an extra ? added to them. That's a bug, without a shadow of a doubt.
Reply with quote
ins0mnia
Novice


Joined: 23 Jan 2011
Posts: 42
Location: United States

PostPosted: Thu Oct 06, 2011 4:50 am   
 
Assuming the manual is out of date, and assuming there's a preference for it just for shits and giggles is pretty silly.

Anyway, other wildcards do it as well.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Oct 06, 2011 4:54 am   
 
Fixed.
_________________
EDIT: I didn't like my old signature
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Oct 06, 2011 5:20 am   
 
ins0mnia wrote:
Assuming the manual is out of date, and assuming there's a preference for it just for shits and giggles is pretty silly.

Anyway, other wildcards do it as well.


Oh, now I'm "assuming" there's a preference for it? What do you call this then?


BTW, the manual isn't out of date. You are correct in that by default you can't use wildcards inside {} trigger patterns. But there is a setting to override it, please stop denying that.
Reply with quote
ins0mnia
Novice


Joined: 23 Jan 2011
Posts: 42
Location: United States

PostPosted: Thu Oct 06, 2011 5:56 am   
 
Emphasis on the "for shits and giggles", I'm aware it exists, thanks for the screenshot though.. I was getting at the fact you don't see prefs to use database variables for instance. You can stop being so defensive.

MattLofton just updated the line, so it was incorrect, and my point was - why flip a switch to do something the manual says you can't, then say it doesn't work..

Since it's changed, sure, bug. Congrats.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Thu Oct 13, 2011 9:11 pm   
 
Look how CMUD converts your pattern into regex, just above the "pattern" tab

^{(*) test}$ ===> (?:(.*) test)? Shocked
(!!!)
Match the regular expression below «(?:.* test)?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»


When you remove capturing (), CMUD change regex to (?:.* test), that's why it stop match an empty line.

Yeah, an awful conversion. But you said you use a stringlist in your trigger? There is a hint for a workaround in CMUD version history.
Quote:
2.26 5-Jun-08 (Public)
Wildcards in string lists and database variables are now properly escaped when using them in a {{@varname}} pattern. Use %string or %dbkeys to convert the string list or database variable to a regular string to allow wildcards in the string list to take effect

... and it works (just tested in untitled session) fine, although you must add intermediate variable in this case and use it in your trigger instead of original stringlist. I fear that with quote above one can call this behavior not a bug but rather "annoying feature"...

I'm sure there are topics exist on this forum as well, you may want to find them (someone had reported this bug before it got fixed).
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Oct 13, 2011 11:27 pm   
 
I don't see how this could be an annoying feature, the conversion to regex is just plain wrong.
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: Fri Oct 14, 2011 8:11 am   
 
Daern wrote:
I don't see...

Quote:
Use %string ... to allow wildcards in the string list to take effect

Normally bugs are get fixed. But if a bug've got a workaround instead... I dunno.
_________________
My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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

© 2009 Zugg Software. Hosted by Wolfpaw.net