gergy008 Posted March 18, 2013 Share Posted March 18, 2013 Hey everyone! It's been a while ^^ So I've run into a regex problem, it was never my strong point tbh, however, I've come across an issue I can't seem to find a solution to Basically I'm using the following regex to check if a password meets the requirements, which are: Contains a letter Contains a number Can use only A to Z, a to z, 0 to 9 and any of these in the password too:!@#$%. What's going on? Heres line 81, and the error I'm getting. elseif(preg_match('^(?=.*\d+)(?=.*[A-z])[0-9A-z!@#$%]$', $pwds['pwd'])!=1) $problems['pwd']='Passwords must contain one letter and number. Also allowed: .!@#$%'; A PHP Error was encountered Severity: Warning Message: preg_match(): No ending delimiter '^' found Filename: controllers/daemon.php Line Number: 81 Thanks!Gergy. Link to comment https://forums.phpfreaks.com/topic/275835-no-ending-delimiter-found/ Share on other sites More sharing options...
Christian F. Posted March 18, 2013 Share Posted March 18, 2013 You forgot the delimiters, which is what PHP is complaining about. The old ereg_* () family of functions didn't require the delimiters, which is the most common cause of this issue amongst people who're either used to working with them or looked at (too) old guides. The easiest way to fix the problem, is to add a pair of slashes to the start and end of the regular expression. Check the examples for preg_match for more information. Link to comment https://forums.phpfreaks.com/topic/275835-no-ending-delimiter-found/#findComment-1419437 Share on other sites More sharing options...
gergy008 Posted March 18, 2013 Author Share Posted March 18, 2013 Dude you're a star, I completely forgot about those things, I need to back to lesson zero XD thanks! Link to comment https://forums.phpfreaks.com/topic/275835-no-ending-delimiter-found/#findComment-1419439 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.