Hey I'm getting a very in-descriptive REG_BADRPT error on the following line:
if(ereg('(?=^.{8,20}$)((?=.*\d)|(?=.*\W+))(?![.
])(?=.*[A-Z])(?=.*[a-z]).*$', $_POST['password']))
Can anyone see what the problem is?
I've used the same regex in javascript and it works fine so not sure what the problem is here.
What I'm trying to achieve here is set a regex that would validate strings that contain:
Well I ended up changing the regex with this one and it works fine:
if(preg_match("#.*^(?=.{8,20})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$#", $_POST['password']))
Stil dont know what the problem was before
Ereg is deprecated in php 5.3. Try using preg_match('/(?=^.{8,20}$)((?=.*\d)|(?=.*\W+))(?![. ])(?=.*[A-Z])(?=.*[a-z]).*$/', $string)
and see if you still get the error.