Mysql regex to retrieve string with more then 6 digits in between of any string type (aphabets or non-alphabets) -
i required retrieve data rows match pattern, like:
asdasdasd123456@gmail.com genuineemail90867889@yahoo.com
need retrieve, strings pattern {all_string}{digits_morethen_6}{all_strings}
in mysql, can me right regex implement in sql script
where col regexp '[0-9]{7}'
that looks 7 digits (more 6) anywhere in string.
if need parts before , after non-empty, then:
where col regexp '[^0-9][0-9]{7,}[^0-9]'
this looks @ least 7 digits, preceded , followed non-digit.
edit
examples (of second regexp):
mysql> select 'asdf2345zxcv' regexp '[^0-9][0-9]{7,}[^0-9]'; +-----------------------------------------------+ | 'asdf2345zxcv' regexp '[^0-9][0-9]{7,}[^0-9]' | +-----------------------------------------------+ | 0 | +-----------------------------------------------+ mysql> select 'asdf2344444445zxcv' regexp '[^0-9][0-9]{7,}[^0-9]'; +-----------------------------------------------------+ | 'asdf2344444445zxcv' regexp '[^0-9][0-9]{7,}[^0-9]' | +-----------------------------------------------------+ | 1 | +-----------------------------------------------------+
Comments
Post a Comment