Ashley Clark wrote:
Yes, PostgreSQL does have a regexp search. You use the ~* operator to do a case-insensitive match. So, for example, you'd use this similar SQL to what was shown earlier.

SELECT DISTINCT title FROM program WHERE title ~* '[2abc][5jkl][4ghi][2abc]';

It might also make sense to clamp that to the front of the string in the regex for searching tv shows, or maybe have an option to switch between unrestricted and start of phrase?

From a UI point of view, the choice of "start of phrase" or "unrestricted" may be problematic, so that would make such an option an implementation specific choice (or user config option).


In an example Ian gave earlier in the thread he had a [0\s] at the begining to match a 0 or white space (not sure if the \s is the correct notation for My & PG, but that is fairly irrelevant!). That would allow you to match the start of a word very easily from a UI point of view - just press 0 first!!

If this syntax would also match the start of whole string, then the clamping may not be needed (though I appreciate this would return more results)?

I'm not sure if it would match the start of the whole string tho'... I guess it depends on how the database treats whitespace.

Col.


--

+------------------------+
|     Colin Guthrie      |
+------------------------+
|  [EMAIL PROTECTED]   |
| http://colin.guthr.ie/ |
+------------------------+
_______________________________________________
mythtv-dev mailing list
[EMAIL PROTECTED]
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to