Multiple tests of a record

I'm interested in testing a string field in each record for several things: the number of times that something occurs in the string, the number of times that several different things occur in the string together at the same time, etc., including the record in the selection if a variety of criteria are achieved, otherwise not.      For example, if the letter "a" occurs at least 3 times, or maybe if "a" and "b" don't occur together more than 2 times in that field, or if at least any 2 of the letters "a" or "b" or "c" can be found then the record would be output.      It would seem that I would have to test the field of each record multiple times to accomplish those.      I could use either the "meta_where" gem or regular SQL, but I can't think of how to do this with either. Any suggestions?      Thanks,          Barney

Barney wrote in post #1017017:

I'm interested in testing a string field in each record for several things: the number of times that something occurs in the string, the number of times that several different things occur in the string together at the same time, etc., including the record in the selection if a variety of criteria are achieved, otherwise not.      For example, if the letter "a" occurs at least 3 times,

=~ /a.*a.*a/

or maybe if "a" and "b" don't occur together more than 2 times in that field,

!~ /(ab.*){3,}/

or if at least any 2 of the letters "a" or "b" or "c" can be found

=~ /[abc].*[abc]/