Creating validation with the pattern

0

I'm trying to create a mask in an HTML form field for functional registration, though I'm not getting it. I'm using the pattern tag in HTML5. In input I put the tag this way, pattern="[c]{1}+[0-9]{6}+$" , and would expect the first character to always be a "c" followed by 6 numeric characters ("C999999"). I have read several articles and saw some more standardized models working, what am I doing wrong in this example?

    
asked by anonymous 25.11.2017 / 14:40

1 answer

1

Well in this case it happens because% of your pattern is lowercase and what you want to validate is c uppercase.

For this you need a capture group containing the letter C insensitive case followed by exact 6 numbers.

It would look like this:

c

Test

    
25.11.2017 / 15:53