I am new in regular expression and i was doing some form validation using regular expression. But the problem is most of the regular expression are like
^(?=.{8})(?=.*[A-Z])(?=.*[a-z])(?=.*\d.*\d.*\d)(?=.*[^a-zA-Z\d].*[^a-zA-Z\d].*[^a-zA-Z\d])[-+%#a-zA-Z\d]+$
This one i am using for password validation. For other form validation I found lot of such expression here. Now the problem is when i use them in my code as follows
if(preg_match('^(?=.{8})(?=.*[A-Z])(?=.*[a-z])(?=.*\d.*\d.*\d)(?=.*[^a-zA-Z\d].*[^a-zA-Z\d].*[^a-zA-Z\d])[-+%@#a-zA-Z\d]+$', $password))
I get at least one error. Most of the time it show erro No ending delimiter or unknown modifier etc
You don’t have a delimiter around your expression.
Try this: