The tools provided by the standard Validate Action are too simple for this kind of format. What you might want to do is something like this (through the Item / Extended dialog):
Yes, just put all that in one line. There’s an even neater way to write it using grouping:
match(/d{5,}sd{7,}/)
The number, comma pair in the braces following the d placeholder means “exactly this many” rather than typing out a single match placeholder for each digit. If there was a second number in the braces, it would mean “between this many and that many, inclusive”.
Here’s a working example. The error message will be funny for long-time Action authors, nobody else will get it.
Note that because we’re using onchange here to trigger the checking, the visitor will have to enter something, then click or tab somewhere else before the error will be checked. This means that in a simple form like this, where there’s only one field and a submit button, the validation might never occur. The Action does the right thing – it hooks into the form’s onsubmit handler method, and blocks form submission if there are any errors in the form. So this is a partial solution at best, and will only help you if the form has more fields that the visitor really must tab or click into. Also, it lets an empty field pass as written. Remove the !!this.value && part to make it sensitive to a missing value.