How to use regex to match for number and string?

50 Views Asked by At

My variable column could either be a string or a number/float. I need to use my regex to catch both 20000 and "20000". Right now my regex is /^#{column}$/i which only catches the string "20000". In addition to this, I need it to stay case insensitive which it currently is.

I am using Mongoid to query a mongo database. The whole query is

Mongoid.client("default")["table_name"].find({ field: /^#{row[column]}$/i })
0

There are 0 best solutions below