1

Im searching the way to restric the number of characters allowed at a text type input of a form, but also not counting spaces.

If I use maxlength='5' then a string like a b c counts 5 characters, so I would like to be able to introduce a string like a b c d e where written characters are 5 and spaces are not counting as characters.

I can not restric to maxlength='9', because there could be some other patterns like ab cd e or a b cd e etc...

I think that maybe pattern should be a solution, but I can not find the way how....

UPDATE I tried answers here but it didn't help me, so the solution comes from the comments below:

Andrés Chandía
  • 999
  • 1
  • 16
  • 32
  • 1
    You can simplify the pattern in the link I provided above with the following pattern: `\s*(\S\s*){5}` – ctwheels Sep 18 '17 at 16:24
  • 2
    Thanks @ctwheels I put that the word should be between 8 and 13 characters not counting the spaces: `pattern='\s*(\S\s*){8,13}'` – Andrés Chandía Sep 18 '17 at 17:16

0 Answers0