Jump to content

No ending delimiter '^' found


gergy008
Go to solution Solved by Christian F.,

Recommended Posts

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
Share on other sites

  • Solution

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.