regex - strange SQL query results on MySQL for REGEXP match -


i using mysql , running follow query column title starts a, b or c. below query can still match title test. if give hint wrong, great.

select title customer title regexp '[a-c].*' 

thanks in advance, lin

you need use string start anchor ^ , use binary regexp enable case matching:

select title customer title regexp binary '^[a-c]' 

regexp not case sensitive, except when used binary strings.

note regexp not require full string match, thus, can safely remove .* pattern.


Comments

Popular posts from this blog

javascript - Trigger mouseenter when an animated element touches mouse -

json - Zend error Connection -

java - Using Spring @Transactional with a combination of readOnly and write, when does this entity get committed? -