regex - Mysql find records with double letters in them -


guys need query list me records in there @ least 2 of same letter. unfortunately

"regexp  '[a]|[b]|[c]|[d]|[e]|[f]|[g]|[h]|[i]|[j]|[k]|[l]|[m]|[n]|[o]|[p]|[q]|[r]|[s]|[t]|[u]|[v]|[w]|[x]|[y]|[z]';" 

this 1 not work me, neither same expession [a]{2} attributes.

any suggestions? help

you can use query:

select some_fields some_table field regexp 'a{2}|b{2}|c{2}|d{2}|e{2}|f{2}|g{2}|h{2}|i{2}|j{2}|k{2}|l{2}|m{2}|n{2}|o{2}|p{2}|q{2}|r{2}|s{2}|t{2}|u{2}|v{2}|w{2}|x{2}|y{2}|z{2}'; 

it return records in some_table field contains 2 identical characters side-by-side.

examples of return (based on 1 of local mysql tables):
hobbit
abba
isaac
scrabble

in case characters don't have together, may use other query:

select some_fields some_table field regexp 'a.*a|b.*b|c.*c|d.*d|e.*e|f.*f|g.*g|h.*h|i.*i|j.*j|k.*k|l.*l|m.*m|n.*n|o.*o|p.*p|q.*q|r.*r|s.*s|t.*t|u.*u|v.*v|w.*w|x.*x|y.*y|z.*z'; 

examples of return (based on 1 of local mysql tables):
(double b)
curious (double u)
contrary (double r)
abba (double , double b)

documentation: mysql pattern matching


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -