OiO.lk Blog PHP How can I make these html & php patterns work?
PHP

How can I make these html & php patterns work?


I am trying to make an input with regex for the following pattern:

  • Force start first character with a capital letter
  • Force first character of other WORDS (letters) capital letter
  • Force all other letters in words lowercase
  • Allow numbers & special characters anywhere except 1st character of words
<input type="text" name="display_name" placeholder="Display Name" id="display_name" required minlength="1" maxlength="32" 
pattern="[A-Z].{1,1}[a-z1-9\W_]).{,}[ ]{,}[A-Z].{1,1}[a-z1-9\W_]).{,}[ ]{,}[A-Z].{1,1}[a-z1-9\W_]).{,}[ ]{,}">

Also, if you can do this pattern, can I also get the same pattern to use for php pregreplace.



You need to sign in to view this answers

Exit mobile version