I have this regex which works when I test it online and have it copied the exact same way on the trigger under search text and have the RegEx box checked.
/(looted a Words of) (the Element|Tyranny|Dominion|Transcendence|Dimension|Coercion|Sight|Detention|Duress|Collection \(Azia\)|Convocation|Incarceration|Bondage)/igs
I want it to match when a party member loots a word I need for research.
Any ideas what I did wrong?
Oh, some examples to test with where:
[Sun Jun 07 00:02:03 2015] --Smorgas has looted a Words of Derivation.--
[Sun Jun 07 00:14:54 2015] --Blud has looted a Words of the Element.--
[Sun Jun 07 00:53:03 2015] --You have looted a Words of Reviviscence.--
[Sun Jun 07 00:55:47 2015] --Blud has looted a Words of the Spoken.--
[Sun Jun 07 00:55:52 2015] --Blud has looted a Words of Radiance.--
[Sun Jun 07 01:02:01 2015] --Blud has looted a Words of Discernment.--
[Sun Jun 07 01:15:44 2015] --You have looted a Words of Imitation.--
[Sun Jun 07 01:20:52 2015] --You have looted a Words of Tyranny.--
[Sun Jun 07 01:21:51 2015] --Blud has looted a Words of Collection (Azia).--
[Sun Jun 07 01:22:01 2015] --Blud has looted a Words of Recluse.--
[Sun Jun 07 01:27:25 2015] --Blud has looted a Words of Imitation.--
[Sun Jun 07 01:29:28 2015] --Blud has looted a Words of Derivation.--
[Sun Jun 07 01:29:33 2015] --Blud has looted a Words of the Sentient (Beza).--
[Sun Jun 07 01:34:36 2015] --Blud has looted a Words of Materials.--
Regex for Words of xxx
Re: Regex for Words of xxx
Use the following instead:
looted a Words of (the Element|Tyranny|Dominion|Transcendence|Dimension|Coercion|Sight|Detention|Duress|Collection \(Azia\)|Convocation|Incarceration|Bondage)
Flags ("/igs") are passed as a separate parameter .Net RegEx rather than as part of the pattern. GINA automatically applies the /i (case insensitive search). The /s flag is unnecessary because GINA processes one line at a time so there will never be new line characters in the string, and the /g flag is unnecessary because it controls how we capture the groups in the match for later use which doesn't apply.
Technically, the parenthesis around "looted a Words of" should have been fine, so I am going to look into why that is not working. However, removing the parenthesis from that phrase results in a large performance boost on the trigger in GINA because GINA cheats. If it can do a rudimentary check to determine that there is a part of a string that will always be present in the matched text, GINA will do a "precheck" using a few characters of that phrase. This check is much faster than a RegEx match test, so lines which do not match can be discarded much faster.
looted a Words of (the Element|Tyranny|Dominion|Transcendence|Dimension|Coercion|Sight|Detention|Duress|Collection \(Azia\)|Convocation|Incarceration|Bondage)
Flags ("/igs") are passed as a separate parameter .Net RegEx rather than as part of the pattern. GINA automatically applies the /i (case insensitive search). The /s flag is unnecessary because GINA processes one line at a time so there will never be new line characters in the string, and the /g flag is unnecessary because it controls how we capture the groups in the match for later use which doesn't apply.
Technically, the parenthesis around "looted a Words of" should have been fine, so I am going to look into why that is not working. However, removing the parenthesis from that phrase results in a large performance boost on the trigger in GINA because GINA cheats. If it can do a rudimentary check to determine that there is a part of a string that will always be present in the matched text, GINA will do a "precheck" using a few characters of that phrase. This check is much faster than a RegEx match test, so lines which do not match can be discarded much faster.
-
- Posts: 6
- Joined: Tue Jun 09, 2015 12:20 am
Re: Regex for Words of xxx
Great thanks you Gimagukk.
I'll give it a go this evening!
I'll give it a go this evening!
-
- Posts: 6
- Joined: Tue Jun 09, 2015 12:20 am
Re: Regex for Words of xxx
Works perfectly now!
Re: Regex for Words of xxx
Version 1.0.20.4 (beta) corrects the issue which prevented the parenthesis around the first few words from working correctly. I'll do a more detailed post on how GINA takes a performance shortcut for regular expression triggers in the next week.
-
- Posts: 6
- Joined: Tue Jun 09, 2015 12:20 am
Re: Regex for Words of xxx
Great, thanks for the follow up gimagukk!