spanna128 Posted April 26, 2012 Share Posted April 26, 2012 Hi im trying to do a registration form and i am new to using preg_match. I keep getting the error "( ! ) Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in C:\wamp\www\registration1.php on line 67" and for every other line I use preg_match. this is an example of how i have used it if ( preg_match('^[[:alnum:]\.\'\-]{4,50}$', stripslashes(trim($_POST['UserName']))) ) { $UserName = mysql_real_escape_string($_POST['UserName']); $query = "SELECT UserName FROM Users WHERE UserName = '$UserName'"; $result = @mysql_query($query); $num = @mysql_num_rows($result); im such a noob at this can someone please help me I would also like to add that I have read the http://www.php.net/manual/en/function.preg-match.php page but i dont really understand it. Quote Link to comment https://forums.phpfreaks.com/topic/261671-preg_match-please-help/ Share on other sites More sharing options...
xyph Posted April 26, 2012 Share Posted April 26, 2012 http://php.net/manual/en/regexp.reference.delimiters.php Quote Link to comment https://forums.phpfreaks.com/topic/261671-preg_match-please-help/#findComment-1340899 Share on other sites More sharing options...
spanna128 Posted April 26, 2012 Author Share Posted April 26, 2012 http://php.net/manual/en/regexp.reference.delimiters.php I have read that too Im just not sure exacty where to put the delimiters. i have tried multiple different delimeters and im either putting them in the wrong place or closing them wrong i'm just not sure. Can you please provide an example Quote Link to comment https://forums.phpfreaks.com/topic/261671-preg_match-please-help/#findComment-1340902 Share on other sites More sharing options...
xyph Posted April 26, 2012 Share Posted April 26, 2012 preg_match( '#[a-z]++#i', $data, $matches ); Quote Link to comment https://forums.phpfreaks.com/topic/261671-preg_match-please-help/#findComment-1340905 Share on other sites More sharing options...
spanna128 Posted April 26, 2012 Author Share Posted April 26, 2012 preg_match( '#[a-z]++#i', $data, $matches ); i have solved it thanks Quote Link to comment https://forums.phpfreaks.com/topic/261671-preg_match-please-help/#findComment-1340908 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.