 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Jun 17, 2008 1:57 am
[2.27] Error in trigger pattern? |
I do a test trigger on the following trigger and get an error message:
#REGEX {^(?:[(\d+)] |)Your (.+) (?:@damagetest) .+[(\d+)]} {do my stuff here}
When I try to test it, it pops up with this message:
| Quote: |
Error in trigger pattern:
^(?:[(\d+)] |)Your (.+) (?:[]wounds|tickles|scratches|scars|RENDS|pimpslaps|OBLITERATES|nicks|MUTILATES|misses|mauls|MASSACRES|mars|mangles|maims|LACERATES|hits|grazes ....) .+ [(\d+)]
POSIX collating elements are not supported (998) |
The little [] is the box that shows up (I thought that was fixed?) under test tab. It shows up here, too.
For the sake of others, this is what is all in that damagetest variable:
#VAR damagetest {misses|tickles|bruises|scratches|grazes|nicks|scars|hits|injures|wounds|mauls|maims|mangles|mars|LACERATES|DECIMATES|DEVASTATES|ERADICATES|OBLITERATES|EXTIRPATES|INCINERATES|MUTILATES|DISEMBOWELS|MASSACRES|DISMEMBERS|RENDS|- BLASTS -|-= DEMOLISHES =-|** SHREDS **|**** DESTROYS ****|***** PULVERIZES *****|-=- VAPORIZES -=-|<-==-> ATOMIZES <-==->|<-:-> ASPHYXIATES <-:->|<-*-> RAVAGES <-*->|<*><*> LIQUIDATES <*><*>|<*><*><*> EVAPORATES <*><*><*>|<-=-> SUNDERS <-=->|<=-=><=-=> TEARS INTO <=-=><=-=>|<->*<=> WASTES <=>*<->|<-+-><-*-> CREMATES <-*-><-+->|<*><*><*><*> ANNIHILATES <*><*><*><*>|<--*--><--*--> IMPLODES <--*--><--*-->|<-><-=-><-> EXTERMINATES <-><-=-><->|<-==-><-==-> SHATTERS <-==-><-==->|<*><-:-><*> SLAUGHTERS <*><-:-><*>|<-*-><-><-*-> RUPTURES <-*-><-><-*->|<-*-><*><-*-> NUKES <-*-><*><-*->|-<[=-+-=]<:::<>:::> GLACIATES <:::<>:::>[=-+-=]>-|<-=-><-:-*-:-><*--*> METEORITES <*--*><-:-*-:-><-=->|<-:-><-:-*-:-><-*-> SUPERNOVAS <-*-><-:-*-:-><-:->|does UNSPEAKABLE things to|does UNTHINKABLE things to|does UNIMAGINABLE things to|does UNBELIEVABLE things to|pimpslaps}
Yes, I've also tried using:
#VAR damagetest "misses|tickles|bruises|scratches|grazes|nicks|scars|hits|injures|wounds|mauls|maims|mangles|mars|LACERATES|DECIMATES|DEVASTATES|ERADICATES|OBLITERATES|EXTIRPATES|INCINERATES|MUTILATES|DISEMBOWELS|MASSACRES|DISMEMBERS|RENDS|- BLASTS -|-= DEMOLISHES =-|** SHREDS **|**** DESTROYS ****|***** PULVERIZES *****|-=- VAPORIZES -=-|<-==-> ATOMIZES <-==->|<-:-> ASPHYXIATES <-:->|<-*-> RAVAGES <-*->|<*><*> LIQUIDATES <*><*>|<*><*><*> EVAPORATES <*><*><*>|<-=-> SUNDERS <-=->|<=-=><=-=> TEARS INTO <=-=><=-=>|<->*<=> WASTES <=>*<->|<-+-><-*-> CREMATES <-*-><-+->|<*><*><*><*> ANNIHILATES <*><*><*><*>|<--*--><--*--> IMPLODES <--*--><--*-->|<-><-=-><-> EXTERMINATES <-><-=-><->|<-==-><-==-> SHATTERS <-==-><-==->|<*><-:-><*> SLAUGHTERS <*><-:-><*>|<-*-><-><-*-> RUPTURES <-*-><-><-*->|<-*-><*><-*-> NUKES <-*-><*><-*->|-<[=-+-=]<:::<>:::> GLACIATES <:::<>:::>[=-+-=]>-|<-=-><-:-*-:-><*--*> METEORITES <*--*><-:-*-:-><-=->|<-:-><-:-*-:-><-*-> SUPERNOVAS <-*-><-:-*-:-><-:->|does UNSPEAKABLE things to|does UNTHINKABLE things to|does UNIMAGINABLE things to|does UNBELIEVABLE things to|pimpslaps"
As a side note, if the variable is changed from stringlist to expanded or literal, the error pops up without the [], and instead, gives me the last line:
nothing to repeat (280).
*shrug*
Any clues? Or is this another bug that needs fixing?
Charneus |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jun 17, 2008 2:28 am |
I suspect it's because of all those unquoted special characters - I can't remember if that was changed or not (or even if it will be)
|
|
|
|
 |
charneus Wizard

Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Tue Jun 17, 2008 2:51 am |
That may be. I know Zugg fixed the problem with the = character within string lists being passed on as a database variable... :\
*shrug*
However, putting them in quotes should automatically "quote" those special characters, am I right? Thought it was supposed to turn it into a literal string, so while it may read <*>, it actually is treated as ~<~*~>...
I can try quoting all the characters, though.
Charneus |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jun 17, 2008 2:58 am |
No, that just means it's passed as a string to the regex compiler. You'll need to escape them with \ for it to work. I suspect you'd have to escape them with ~ if you were using a normal trigger, too.
|
|
|
|
 |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Tue Jun 17, 2008 2:14 pm |
I thought zugg fixed wildcard characters in string lists being used in patterns... or is that only when encompassed in {}?
|
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jun 17, 2008 3:24 pm |
Perhaps, but sometimes you want wildcards to be passed to the parser, so he may have decided not to change it.
|
|
|
|
 |
Toxic Adept
Joined: 27 May 2008 Posts: 299
|
Posted: Tue Jun 17, 2008 3:31 pm |
I think you have to use %%string() or %%dbkeys() in your pattern to allow wildcards to pass to your pattern.
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 17, 2008 7:05 pm |
Automatically escaping special characters/wildcards is ONLY done when using zScript pattern syntax. When you mark a trigger as a Regular Expression, then it is up to you to create a valid regular expression and to properly escape special characters. This is one of the reasons why I always recommend that you use zScript pattern syntax whenever possible. When using zScript syntax, then Toxic is correct that you have to use %%string or %%dbkeys to use wildcards in a stringlist or database variable. And automatically escaping special characters is ONLY done in a zScript pattern within a {} subpattern.
The *only* conversion done when using string list/database variables in a Regular Expression trigger pattern is that CMUD will automatically sort the list in descending order so that larger strings are placed first in the resulting regular expression.
So yes, in this situation the problem is that you have a bunch of wildcards in your string list causing problems.
I'll check into the [] control character that is still being displayed in the error message. CMUD strips this before passing the string to the PCRE engine, but I think it's just not stripping it when displaying the error message. |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 17, 2008 7:20 pm |
Also, I think the actual problem in your regular expression is this:
[(\d+)]
If you are trying to match verbatim [] characters then put a \ before each one. Normally in a regular expression, [] are used to specify a character range. So I think your pattern should be:
#REGEX {^(?:\[(\d+)\] |)Your (.+) (?:@damagetest) .+\[(\d+)\]} {do my stuff here}
Also, you have this:
(?:[(\d+)] |)
and putting the |) to allow a null pattern isn't the correct way to do that. It should be (?:[(\d+)] )? |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jun 17, 2008 7:51 pm |
When I was working on this report, I also found a problem that could prevent a %%function from working within a regular expression. That is fixed for 2.28.
Also, I am adding a new function to v2.28 called %quoteregex that can be used to quote the special characters in a string with the \ character. So in v2.28, you can call:
^(?:\[(\d+)\] )?Your (.+) (?:%%quoteregex(@damagetest)) .+\[(\d+)\]
to properly quote your string list special characters. This pattern is tested and working for v2.28. |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jun 17, 2008 7:56 pm |
The backslash-[ combo is used by phpbb, so it was being eaten in your posts, Zugg. I've fixed it.
|
|
|
|
 |
|
|
|