Hi, I have eForm working well but want to add some validation to block users submitting forms that contain a specific string in the message text. Looking at the documentation looks like I could use the #REGEX feature to do this. Is this the best way? My regular expression knowledge is a bit limited.
For example I know \abcd\ will test if the string contains abcd but how do I say ’does not contain’ abcd?
Am I on the right track?
Thanks in advance.
Tim
Thanks for the suggestion. I want to validate the input though. If the message contains the string I want to reject the form and display an error text. eForm is great for this. For example I can make a validation rule #REGEX /abcd/ which rejects the field if it DOES NOT contains the string abcd but what I really want is to reject it if it DOES contain the string.
Any regular expression experts out there who can advise if this is possible? Or maybe I should be using the eForm #EVAL feature?
-
☆ A M B ☆
- 24,524 Posts
Use a negative regexp; that’s a ^ to negate an expression.
* #REGEX - regular expression - syntax as for preg_match() - see php manual
example: #REGEX /^[a-z]+ [a-z0-9_]+/i
The above example will look for anything that is NOT alphanumeric, case insensitive. er... I think... probably best to go over the php manual on the subject!