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

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

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

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -