|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:14 am
Reg-exp problems with version 6.40 |
I am trying to compose a trigger that fires if any number of words followed by " is here." is received. I tried implementing it like:
^([a-zA-Z]+s)+is here.$
and wanted it to trigger on such lines as "Roger is here.", "Roger Rabbit is here." or "Roger the Rabbit is here.", which it does.
It does, HOWEVER, also fire on "Roger Rabbitis here."(, but not on "Rogeris here."), something I do not want.
I do need to use reg-exp for this. The above is only a simplification of the problem I am having. I need reg-exp to make the full trigger act as supposed to. |
|
|
|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:20 am |
(noted should be that:
^([a-zA-Z]+s)$
triggers correctly on "Roger ", "Roger Rabbit ", and so forth. I can't see what I'm doing wrong, if it is indeed my fault) |
|
|
|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:22 am |
ahh, I forgot to add a + before the $ in the last example. Problem is still the same though
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Jul 15, 2003 2:32 am |
You seem to be contradicting yourself, but anyhow why not simply use a pattern of:
^(*) is here.$
If you really need the trailing space to be captured with the variable simply tack it on with %concat. |
|
|
|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:40 am |
I am not contradicting myself. Ok, I'll post the full expression so you see what I am trying:
^(([0-9]+h, [0-9]+m [a-z]*-)*s?)?([a-zA-Z]+s)+ draws his blade
This should work with:
Sir Roger draws his blade
or
Sir Roger the Knight draws his blade
500h, 500m - Sir Roger draws his blade
or
500h, 500m - Sir Roger the Omnipotent draws his blade
but also works with
500h, 500m - Sir Rogerdraws his blade
or
Sir Roger the Fooldraws his blade |
|
|
|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:42 am |
and as usual I have mistyped the reg-exp. what I am trigging at is:
^(([0-9]+h, [0-9]+m [a-z]*-)*s?)?([a-zA-Z]+s)+draws his blade |
|
|
|
teknocide Beginner
Joined: 15 Jul 2003 Posts: 25 Location: Sweden
|
Posted: Tue Jul 15, 2003 2:43 am |
^(([0-9]+h, [0-9]+m [a-z]*-)*s?)?([a-zA-Z]+s)+draws his blade
really sorry for multi-posting. I can't seem to edit my posts |
|
|
|
|
|