April 18th, 2012, 09:03 AM
Little confused, don't work as expected...
I have a regex like
/^(?!(.*(<?php echo $text_string; ?>).*))/
where the $text_string is
my regex does not allow HELP_GUIDE_TEXT_1
I want to have a regex that does not accept a new name that is in the string, that is
NOT HELP_GUIDE_TEXT - OR - SOMEOTHER_INFO - OR - YETAGAINSOMEOTHERINFO
should accept something like
HELP_GUIDE_TEXT_1 - OR - SOMEOTHER_INFO_1 - OR - YETAGAINSOMEOTHERINFO_1
How do I do this?
Thanx in advance!
April 18th, 2012, 09:41 AM
Just to be absolutely clear about what you're doing, what does your code look like?
April 18th, 2012, 09:59 AM
I have a form, I want to validate the input.
My code does not allow HELP_GUIDE_TEXT_1 or HELP_GUIDE_TEXT_2 or HELP_GUIDE_TEXT_3...
I want to prevent adding a new string that is the EXACT same as an old one...
April 18th, 2012, 10:27 AM
Then your expression is simply trying too hard.
and matches are bad. If the match has to be a good thing then wrap the group+$ in a negative assertion.
April 18th, 2012, 02:09 PM
Maybe I am very unclear but what you show me validate that the input has to be in the string...
I want the input NOT to be in the input...
April 18th, 2012, 10:50 PM
Not in? Because you just said not exactly.
Assuming you still mean not an exact match, yes: the expression I posted. If it matches then the input is not valid.