Problem with word boundaries in Valentina 2
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Nov 13 20:47:15 CST 2006
On 11/13/06 6:02 PM, "Martin S." <blackfin at elfenherz.de> wrote:
Hi Martin,
> 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?
In short -- the must work.
Note, that you can make db strength to be primary,
And use then simpler REGEX
fld REGEX '\bbo(.*)'"
\b really is START OF WORD ?
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list