SQL provides a LIKE function for simple pattern matching. Also, both mySql and PostgreSql provide REGEX functions though they may not be identical in use.
Rick Lloyd wrote:
SQL provides a LIKE function for simple pattern matching. Also, both mySql and PostgreSql provide REGEX functions though they may not be identical in use.
So are you suggesting that I do something like this:
string = params[:social] # magic on string until string = "%0%1%2%3%4%5%6%7%8%" ?
Not quite, in PostgreSql you could use
SELECT * FROM tablename WHERE fieldname SIMILAR TO '[-a-z]*0[-a-z]*1[- a-z]*2[-a-z]*3[-a-z]*4[-a-z]*5[-a-z]*6[-a-z]*7[-a-z]*8[-a-z]*'
to push all the filtering into the query.