Still on Drupal 7? Security support for Drupal 7 ended on 5 January 2025. Please visit our Drupal 7 End of Life resources page to review all of your options.
Added new mask type 'r' that other than max_length completely relies on a regex for validation. A bit of code cleanup, and used preg_match to validate the '9' mask instead of testing numeric and > 0, which would have allowed decimals.