darkfreaks Posted September 23, 2009 Share Posted September 23, 2009 not sure why , is the regex right for dash and underscores <?php // underscores/dash if(preg_match("/([_-])/", $password)) { $strength++; } ?> Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted September 23, 2009 Share Posted September 23, 2009 You need to escape - as \- because it's used for defining ranges (e.g. /[A-Z]/) Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted September 23, 2009 Author Share Posted September 23, 2009 still doesnt work now i have /([_\-])/ Quote Link to comment Share on other sites More sharing options...
thebadbad Posted September 23, 2009 Share Posted September 23, 2009 You need to escape - as \- because it's used for defining ranges (e.g. /[A-Z]/) Not when it's placed first or last inside the character class. @OP What are you trying to do? Quote Link to comment 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.