http://qs321.pair.com?node_id=315798


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

Yet another way to do it: /^\d+ *(?<=^.{20})$/ That is, one or more digits, followed by zero or more spaces -- and only thereafter do we check that it summed to 20 characters total. Probably not as efficient (involves more backtracking) but easier for my eyes to understand.

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