So 2 questions that may be due to me not understanding regex, but I just can't seem to get either of the 2 below to work as expected:
1) How do I set a trigger to fire on "this is string1" or "this is another string"?
I coded a few things but I thought the regex would be something like:
(this is string 1|this is another string)
I cannot seem to get a simple thing like this working so any help would be appreciated.
2) Spell casts do not seem to work when tested with the regex flag set. e.g. "An NPC begins to cast spell. <nasty spell>."
If I use exactly that string in the search field it is never detected if regex flag on, but it is if I turn it off. I suspected the <> and tried escaping them but no luck (and as far as I know they are not special characters in normal regex).
This is not too big a problem but the ability to use regex would open up the ability to look for similar but different strings rather than specific ones.
Apologies in advance if my noobiness is getting the better of me.
Testing for two or more strings + spell check
Re: Testing for two or more strings + spell check
As an example: you can use the trigger from the Rain of Fear Raid in Breeding grounds
Velishan, The Deceitful begins to cast a spell. <Scales of Fire>
This matches just fine without the need for RegEx.
So my guess is that you have something missing from your Search string for the spell cast.
Edit: Just a quick glance at your search string... You're missing the a between cast and spell
So your search string would be An NPC begins to cast a spell. <nasty spell>
Sorry I can't help you with the first part RegEx still gives me fits and I've had to ask for help here.
Velishan, The Deceitful begins to cast a spell. <Scales of Fire>
This matches just fine without the need for RegEx.
So my guess is that you have something missing from your Search string for the spell cast.
Edit: Just a quick glance at your search string... You're missing the a between cast and spell
So your search string would be An NPC begins to cast a spell. <nasty spell>
Sorry I can't help you with the first part RegEx still gives me fits and I've had to ask for help here.
Re: Testing for two or more strings + spell check
Thanks for your reply Settun.Settun wrote: So my guess is that you have something missing from your Search string for the spell cast.
Edit: Just a quick glance at your search string... You're missing the a between cast and spell
So your search string would be An NPC begins to cast a spell. <nasty spell>
Sorry I can't help you with the first part RegEx still gives me fits and I've had to ask for help here.
I was only giving an example. I type the test string in a game window, to a specific channel, exactly as being tested. It is not detected with regex on.
Yes it is detected fine with regex off. That's how I do it now. But as I said in my original post, I wanted to use regex so I could create some generic rather than specific triggers.
I just don't know which version of regex GINA uses but it doesn't seem to be standard or working as intended for some (minor) instances.
Re: Testing for two or more strings + spell check
I think I found out how to test for 2 or more strings in a single trigger from an example I found elsewhere.
Looks like you simply need to escape every space, e.g.
(this\sis\sstring\s1|this\sis\sanother\sstring)
The actual one I found was for the Arc Mentis Vitio, one off raid and is the one to detect if you failed several conditions:
(You\sare\scaught\sin\sVitio\'s\sbackswing|You\sare\sstruck\swith\sthe\spower\sof\sthe\sCitadel|You\sare\spummeled\sby\sVitio\'s\srampage|You\sare\ssliced\sby\sVitio\'s\sblade|You\sare\sstruck\sby\sVitio\'s\shammer)
I will try this with the spell casting issue too - it may be a similar lack of escaping that causes that.
Hope that helps.
Looks like you simply need to escape every space, e.g.
(this\sis\sstring\s1|this\sis\sanother\sstring)
The actual one I found was for the Arc Mentis Vitio, one off raid and is the one to detect if you failed several conditions:
(You\sare\scaught\sin\sVitio\'s\sbackswing|You\sare\sstruck\swith\sthe\spower\sof\sthe\sCitadel|You\sare\spummeled\sby\sVitio\'s\srampage|You\sare\ssliced\sby\sVitio\'s\sblade|You\sare\sstruck\sby\sVitio\'s\shammer)
I will try this with the spell casting issue too - it may be a similar lack of escaping that causes that.
Hope that helps.
Re: Testing for two or more strings + spell check
GINA uses .Net's implementation of RegEx. There are a couple of tricks that I do to increase performance (e.g., if any static text is discovered outside of grouping constructs, I grab up to 8 characters of that text so that I can do a much, much faster "quick check" on log lines to determine if the regex is a potential match, and skip the regex comparison if that short string doesn't match. For regular expressions which are completely composed of grouping constructs I can't take that shortcut, so you'll generally see those triggers taking more CPU time in the profiler (just added in 1.0.20.0 beta).
The example you listed in your original post is working fine for me, just like you posted it using version 1.0.19.2 (live) and 1.0.20.1 (beta). The spell example worked as well. The <> do serve as special characters, but only for names groups (e.g., "(?<text>\w+)" would capture word characters in a group called "text", but your example isn't triggering that special case for me.
The example you listed in your original post is working fine for me, just like you posted it using version 1.0.19.2 (live) and 1.0.20.1 (beta). The spell example worked as well. The <> do serve as special characters, but only for names groups (e.g., "(?<text>\w+)" would capture word characters in a group called "text", but your example isn't triggering that special case for me.