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: