This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

syntax checking of user input on a public trigger

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Looking abit closer at the a|b|cd example, you also accept an empty string with your pattern.
That said, I just tested the relevant parts of your code, with my expression, and it works just fine for me.

Unfortunately, you can't get any error messages as for why your pattern didn't match your string. Regular expressions is a tedious game of trial, frustration, and error.

A few more remarks anyway;
There's no point in creating a bracket expression containing a single character, it just clutters your expression. Bracket expressions is best used to match a range of characters, such as a-z or 0-9.
Back references are powerful, but they can make the expression harder to follow. Especially when you place them within a bracket expression.
NML_375
L
LoKii
Voice
Posts: 34
Joined: Wed Oct 21, 2009 3:59 am

Post by LoKii »

Thanks for your insight on this. In this case, i will leave this thread as unsolved for the time being (although in current, it works as expected), and I will try to implement you recommendations. I will leave this part of the entire script to the last, since it seems that this regex will be very time consuming. ( I need to add various regex solutions to another 10 - 20 commands), so i will work on the regex in between as much as time allows and finish off all the non-regex things on my to-do list for now.

My main goal in this is to get rid of all the escapes, that would indeed make the regex syntax much shorter, and more readable.

Cheers :)
Post Reply