in reply to Regex to match 20 chars of some digits followed by some spaces

Sounds like you just need to move the checking for digits bit into your program logic and out of your rule. I.e., match 20 chars and then in your code, check that you got the requisite number of digits. Something like:

account: /\d[ \d]{18} /

I interpret your example to mean that you always want one digit and one space. Of course, that will let things like "12 56 90123456789 " through, but that's where you use one of those nifty code block after the rule :)

  • Comment on Re: Regex to match 20 chars of some digits followed by some spaces
  • Download Code