What I understood is that you want the check to pass if it's not a number, so why don't you change the regex to match anything other than numbers:
/^(?!\d)/
Using your code, it will
validates_format_of :my_str, :with => /^(?!\d)/, :allow_blank = true
Or:
as the documentation says
Alternatively, you may require that the specified attribute do not match the regular expression with the option: no option.
So:
validates_format_of :my_str,format: { without => /\d:\d/}, allow_blank = true
with validates_format_of checks attribute values, checking to see if they match the given regular expression, which is set using the :with or :without options
source share