Pro Forms: How to use patterns

I’m trying out the pro forms and I would like to create an input field that allows only 11 digits. I put in the pattern [0-9]{11} but it would not let me type any number at all on the front end. What could I be doing wrong?

Not a regex pro or anything but try something like (.,'^[0-9]{11}$')
If that doesn’t work, try googling for it, theres quite a few stackoverflow posts and other articles giving solutions with slight differences so just a matter of trying them I guess :wink:

Thanks @manc

I don’t think there is anything wrong with the regex pattern I set. I used it on a different form and it works just fine, I also tested it using RegExpr.

But the patterns don’t seem to be working/validating well on the Pro Forms. It might be a setting that I’m missing.

I noticed it works fine when I use it in the live validation area.

But if I add it within the pattern, I can not type in any text.

I tried it too and must agree with Daveden2, Pattern is not working in Pro Forms (section General).

The purpose of the pattern in the “General” tab is to prevent certain characters from being entered. For example, you could use it to ensure that only numbers are allowed using something like [1-9]*

Regex like [0-9]{11} will not work here, as there will never be 11 characters, as the regular expression is evaluated as a whole. In this case, use the “Validation” group with “Live Validation” activated. This is more suitable for this purpose.

3 Likes