Thanks for the helpful reply, could you please help me to make a select statement to search abc-def by using abcdef in where clause, please correct me if I am wrong:
select field from table where field like 'abcdef' regexp '^[[:alnum:]]+-*[[:alnum:]]+$';
4:39 pm on Aug 19, 2010 (gmt 0)
I don't think you're going to be able to do that. The regexp must match the data, not the other way around, and you're asking to insert a character where there isn't one in the string, and it really can be anywhere. You could preprocess the input so it's like this, and do a long series of "or's":
where field = 'a-bcdef' or field = 'ab-cdef' or field = 'abc-def' ....
but that would be extremely unwieldy. You should probably re-think your front end, like