Regex that contain only alphanumeric and special characters in MySQL -


i'm trying select rows contain english , special characters in mysql using:

select * table column regexp '^[a-za-z0-9 \-\:\(\)\&\.\,\?]+$' 

i don't know wrong when try adding - : ( ) & . , ? ! ' | < >.

the special character want: - : ( ) & . , ? ! ' | < >

note when add characters character class, not have blindly escape of them, , if have escape them, must use double \\ backslash in mysql regex. however, not necessary. when place - hyphen @ start or end of character class, or right after posix character class, treated literal hyphen. other "special" characters need not have escaped in character class.

also, ' should doubled in single quoted string literal.

so, use

select * table column regexp '^[a-za-z0-9 :()&.,?!''|<>-]+$' 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -