0

I need to limit a text input to letters, numbers and a few characters including ' and ". The code I have without the ' looks like this: pattern='[a-zA-Z0-9\s+"*]{3,}' This works fine, but when I try to add the ' inside the brackets, escaped or not, it fails. I have looked at all of the answers about patterns and regex here and elsewhere and can't seem to nail it. Thanks for the help.

5
  • What language are you using? Commented Jul 14, 2018 at 15:03
  • PHP Sorry I left that out. Commented Jul 14, 2018 at 15:12
  • Perhaps this page using htmlentities can be helpfull Commented Jul 14, 2018 at 15:25
  • 1
    Thank you. htmlentities was the answer. I would never have thought to use that solution. Commented Jul 14, 2018 at 15:31
  • pattern='[a-zA-Z0-9\s+\\x22*]{3,}' or pattern='[a-zA-Z0-9\s+\x22*]{3,}' should work, too. Commented Jul 14, 2018 at 15:48

0

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.