Problem with word boundaries in Valentina 2

Martin S. blackfin at elfenherz.de
Mon Nov 13 17:02:50 CST 2006


Hello,

In Valentina 1.xx, I used to do a case-insensitive search for a word, 
that e.g. begins with "bo" in that way:

"SELECT * FROM xxx WHERE yyy LIKE '\<bo' no_case"

I've read trough your documentation for the new Valentina 2 SQL Syntax 
and found that no_case is deprecated and that I have to use RegEx.
No problem I thought, so I've further read through the ICU documentation 
to build a Regular Expression that matches my needs.

The problem that I have with V2 are word boundaries. I want the user to 
type an expression which will be searched as a BEGIN of a word and only 
WITHIN a word.
e.g.: User types "bo", Valentina should find words like "Book", 
"Borrow", but not "unborn" or "rebound".

I tried to use a ICU RegEx which contains word boundary matching:

"SELECT * FROM xxx WHERE yyy REGEX '\b(?i)bo(.*)'"

...but sadly that does not work. The cursor's record count is always zero.
When I leave off "\b", then I get results, but it finds every text that 
CONTAINS the typed string, and not only words that begin with it.
With \b on, there are never any results.

I also tried the other way and set the collation atrribute #kstrength of 
my database to #kprimary, sent RegEx to hell and tried it with good old 
"LIKE" statements.
Unfortunately, when I use the wildcard "%", the results are the same as 
with RegEx. (but a lot faster...).
As I'm rather sure that I won't be able to achieve the right results 
with the use of a LIKE-statement, I'm switching back to RegEx now.

But.....can you explain what I have to do with it to achieve my wanted 
results?
Are ICU word boundaries not yet implemented in V2 or did I something wrong?

regards,

Martin S.




More information about the Valentina mailing list