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

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

json - Zend error Connection -

javascript - Trigger mouseenter when an animated element touches mouse -