Jump to content

PW field backend pattern format


bwakad
 Share

Recommended Posts

In a form I use this:

elseif (!preg_match("/^[A-Za-z0-9]{6,16}$/", $input->post->password)) {

In the backend of PW there is a pattern setting under INPUT tab of the field. But, how to enter this there? Can't find info on that.

With slashes:

/^[A-Za-z0-9]{6,16}$/

Just beginning and end of string:

^[A-Za-z0-9]{6,16}$

Or only this:

[A-Za-z0-9]{6,16}

Link to comment
Share on other sites

The Slashes ( / ) are a php specific thing to implement regex patterns, while the two patterns below are different ones. The first one does only match if the input is a single word, while the latter would also match "Passwrd Passwrd" see: http://regexr.com/39e12 vs. http://regexr.com/39e18

Edit: To answer a little bit more clearly, the second one is the one you should put in the field of the processwire backend, to reflect the first pattern.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...