regexp in sql-statement

Hi there...

easy question and I hope I will get an easy anwser...

I have in my database a table named "my_table" and a column 'my_column'

in my_column I have five entries as string

1. "123"
2. "123 45"
3. "45 123"
4. "12345"
5. "45123"

Now I need a sql-statement to select ONLY the datasets with "123" (this
are the sets 1. 2. 3.)... before the "123" it can be that there is {0,}
whitespaces.. at the and of "123" the same....

but if i try

my_request = myTable.find(:all, :conditions => ["my_column REGEXP :test
", {:test => "[ ]*123[ ]*"} ])

as the result I get all datasets... :frowning:

I used [ ] instead of \s because I donĀ“t know realy how to use the
spezial characters in this statement

I there anyone who knows how to use regexp in find-statements?!?

thanks for helping

I found the answer....

my_request = myTable.find(:all, :conditions => ["my_column REGEXP :test

", {:test => "[[:<:]]123[[:>:]]"} ])

cheers guido

Guido Holz wrote: