Creation of validation with Pattern

Asked

Viewed 73 times

0

I’m trying to create a mask in an HTML form field for functional registration, however I’m not getting it. I’m using the tag pattern HTML5. No input 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 (Format of registration "C999999"). I’ve read several articles and seen some more standardized models working, what I’m doing wrong in this example?

1 answer

1

Good in your case is due to c of his Pattern be tiny and what you want to validate is C capital.

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

Would look like this :

[cC][\d]{6}

Testing

Browser other questions tagged

You are not signed in. Login or sign up in order to post.