While Java doesn't seem to care to explain what "word boundary" means, perl
does:

A word boundary (\b ) is a spot between two characters that has a \w on one
side of it and a \W on the other side of it (in either order), counting the
imaginary characters off the beginning and end of the string as matching a \
W .

So I guess you could use '\bdr\.(\b|$)'.


On Wed, Jun 11, 2014 at 11:12 AM, Cecil Westerhof <cldwester...@gmail.com>
wrote:

> 2014-06-10 23:08 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>:
>
>
>>
>>
>> 2014-06-10 21:29 GMT+02:00 Cecil Westerhof <cldwester...@gmail.com>:
>>
>> I want to find ‘dr.’ on a word boundary. For this I tried:
>>> SELECT quote
>>> ,      author
>>> FROM   quotes
>>> ,      authors
>>> WHERE  LOWER(quote) REGEXP LOWER('\bdr.\b')
>>>    AND quotes.authorID = authors.authorID
>>> ;
>>>
>>> But that does find 'dry', but not 'Dr.'.
>>>
>>> When I change the query to:
>>> ​SELECT quote
>>> ,      author
>>> FROM   quotes
>>> ,      authors
>>> WHERE  LOWER(quote) REGEXP LOWER('\bdr\.\b')
>>>    AND quotes.authorID = authors.authorID
>>> ;
>>>
>>> Nothing is found.
>>>
>>> How could I search for 'Dr.' on word boundaries?​
>>>
>>
>> ​The following works:
>>     WHERE  quote REGEXP '\W
>> ​​
>> [Dd]r\.\W'
>>
>
> ​Better is:
>     WHERE  quote REGEXP '(\W|^)​[Dd]r\.(\W|$)'​
>
>
>
> --
> Cecil Westerhof
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to h2-database+unsubscr...@googlegroups.com.
> To post to this group, send email to h2-database@googlegroups.com.
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to