|
harley Apprentice
Joined: 05 Apr 2008 Posts: 121
|
Posted: Sat Apr 05, 2008 7:45 pm
regex |
I can see the point some of the time for regex triggers
but why are they more desireable vs zScript Triggers?
Faster? just curious on everyones opinioins |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4715 Location: Pensacola, FL, USA
|
Posted: Sat Apr 05, 2008 7:49 pm |
Optional string segments in the pattern is why i am thinking of learning it.
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Dharkael Enchanter
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Sat Apr 05, 2008 8:01 pm |
Ultimately everything in the TRIGGER syntax is translated into a regex.
The TRIGGER syntax is simpler easier to learn/write but can only express some things in the regex language.
Sometimes what you need to match is very complicated and beyond the ability of TRIGGER to express precisely.
In that case you skip the translator and use a REGEX.
In other words TRIGGER is like using a translator that only speaks a little of the language you need to express.
It never makes mistakes but there are things it can't say very well and ideas get lost.
with REGEX you lose the translator and say what you have to say, but if you don't know the language well you can make mistakes,
or be even less effecient than the limited vocab of the translator. |
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Apr 05, 2008 8:52 pm |
There are some things that the zScript trigger syntax can't do. The most common is using wildcards inside the {one|two} syntax. Sometimes you need to use one of these missing features, and so you can use regexes.
Regexes also allow much greater control over the matching engine. People who have a lot of triggers can often spend a lot of time fine-tuning their regexes to improve their matching speed.
For everyday tasks, though, the zScript syntax is simpler and it works. Most people don't need to use regexes - if you find that you're having trouble writing a trigger to match some particular text, though, a regex is usually what you need. |
|
|
|
|
|