10-07-2013 11:10 AM
I am looking to make a regular expression that will exclude a certain string from being allowed on our registration page.
The field is a simple text field.
I am using the option IsRegexMatch.
I found out that the field can accept perl regular expressions. I found this:
Which is a negative lookbehind.
I modified it to match our requirements
However it only works if the word "fox" is put in by itself.
If you add any other word it is accepted.
This will fail
fox Fox FOX etc...
This will be excepted
Fox company fox company company fox company Fox etc...
Is there an easier way to doing this?
Or perhaps I having gone completely wrong with my regular expression.
I had tested my regular expression here and it seemed to work okay.
10-08-2013 05:11 AM - edited 10-08-2013 05:17 AM
I thought about that actually, well sort of.
I had tried this combination
The \w+ at the end is basically like a wild card as defined here.
I never actually considered using just a standard '*'
I will give it a shot and let you know the results!
Thanks for the suggestion.
I tried this
but unfortunately it causes the field to accept everything.
I also tried this
but unfortunately it causes the field to fail everything.
10-08-2013 05:33 AM
Oh I actually found one that works I think
Any combination it appears will be picked up
Fox fox FOX Fox company company fox
All got rejected
You can extend this to into other patterns
This would match
fox or wolf
The only down side that I found is that it will be rejected if the string exists inside another word
So if we wanted to filter out 'over' and you typed 'overly' the string will get rejected.
For what we need it for though it should work.