0

I am using the input pattern on my register form which consists of a Username, Email and Password.

I have set the Username between 5 and 15 characters however when this has been typed correctly and I go to submit the form I am not able to submit, but instead still receive the required title message. Anyone any ideas?

<div class="col-sm-offset-2 col-sm-9"><td><input pattern=".{5, 15}" required title="Username should be between 5 - 15 characters"type="text" class="form-control" name="uname" placeholder="User Name" required/></td> </div>
1

3 Answers 3

1

Remove the space before 15: pattern=".{0,15}"

Sign up to request clarification or add additional context in comments.

Comments

1

You could try this pattern, it works in this fiddle

pattern=".{5,15}$" 

Comments

1

You must remove the space. Compare the explanations from https://regex101.com/

 /.{5, 15}/
  • . matches any character (except newline)
  • {5, 15} matches the characters {5, 15} literally

and

 /.{5,15}/
  • .{5,15} matches any character (except newline)
  • Quantifier: {5,15} Between 5 and 15 times, as many times as possible, giving back as needed [greedy]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.