[sql] regex

Robert Brenstein rjb at rz.uni-potsdam.de
Mon Feb 10 05:16:19 CST 2003


Why the following sql

SELECT r_fna,r_mna,r_lna,r_ema,r_rid
FROM registration1,registration2b
WHERE u_rid = r_rid and r_rid > 0 and
u_mtch LIKE '\broberto\b' and u_mtch LIKE '\bbrenstein\b'

finds match for field containing "robert j brenstein"? robert is not 
roberto, so it should fail in the first LIKE.

When I made the second LIKE non-matching, then the SQL fails as expected.

SELECT r_fna,r_mna,r_lna,r_ema,r_rid
FROM registration1,registration2b
WHERE u_rid = r_rid and r_rid > 0 and
u_mtch LIKE '\brobert\b' and u_mtch LIKE '\bbrensteinson\b'

I am confused. I want to do search on full words.

BTW, Ruslan, the examples in Regex docs in at least vxcmd 
distribution have double backslashes instead of single ones; for 
example \\brobert\\b.

Robert


More information about the Valentina mailing list