Want to search for a string in a text, this string has to appear as the beginning of a word. So when searching for ‘hello’ I don’t want to find fields containing ‘othello’.
But in postgresql this does not work. How can this be achieved in postgresql (database vendor independent)? We cannot force servoy to use a regular expression match (~ in stead of LIKE), can we?
PostgreSQL has support for regex searches but I doubt Servoy or the JDBC driver uses the same syntax as Sybase does. But perhaps Servoy can answer that one.
Also regex searches are not in the SQL standard I believe so to make it database vendor independent code for this might require some more work on your end.
Thanks for the reply. PostgreSQL is indeed much more powerfull with the support for regex but there are much less possibilities in the patterns that can be used with LIKE compared to sybase, ms sql or mysql.
So searching for the beginning of a word in a text-field using a sevoy find()/search() does not seem to be possible. Or does someone has an idea how this can be done?
You can use ‘hello%’ on every sql vendor. It’s the regex part that is not that portable.
So yes, you can search for beginning of a word using that syntax on PostgreSQL and any other vendor.
Or even better use ‘#hello%’ to make it case-insensitive.