The SQL regex stuff others have posted is one way to do it, but note
that scanning a table like that is inherently going to be slow, and
will get slower as the table gets bigger.
If you're doing this operation a lot, it might be valuable to pre-
compute the number strings for the identifier field, like this:
# add a new field, identifier_numbers perhaps
self.identifier_numbers = identifier.gsub(/[^0-9]/,"") if
Then you can just search against identifier_numbers.