I want to write a regex that matches string that has both numeric and alphabets. ^[a-zA-Z0-9]*$
-- this pattern returns numeric as well as alphabets, but I want only alphanumeric. Basically I'm using postgresql to query rows that contain numericals in it.
I think multiple regex's is the easiest way:
where col ~ '^[a-zA-Z0-9]*' and
col ~ '[0-9]' and
col ~ '[a-zA-Z]'
There is probably a complicated regexp that combines this all together, but this seems like the most intuitive method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With