mysql - Impala regex to find "2", but not "255", in pipe-delimited list -


i originally asked help finding values in pipe-delimited list values must include 4 or 5, never 2 or 3. however, accepted solution returns value 255 itself.

i have data set pipe delimited values can either 0,1,2,3,4 0r 255, such this:

|    cola    |  ____________ | 1|1|0|255  | | 5|4|4|2    | | 5|4|4|3    | | 5|4|4|4    | | 1|0|0|0    | | 0|2|0|1|2  | | 5|5|0|5    | | 0|5        | | 5|5|255|255| | 0|3|1|2|3  | | 5|5|5|2|3|3| | 0|2|0|0|0|2| | 5|255|1|1|5| | 4|255|4    | | 2|2|3      | | 255|0      | | 5          | | 5|5|1      | 

i need query return rows include value of 4 or 5, never 2 or 3.

|    cola    |  ____________ | 5|4|4|3    |    | 5|4|4|4    | | 5|5|0|5    | | 0|5        | | 5|5|255|255| | 5|255|1|1|5| | 4|255|4    | | 5          | | 5|5|1      | 

the closest i've come query:

select clin.clin_sig  clinvar clin (clin_sig not regexp '3|2[^5]' , clin_sig regexp '4|[^25]5') 

but it's missing following entries, wonky:

  • 5
  • 5|255
  • 5|5|5|5|5|5|5
  • 5|0
  • 5|255|255
  • 5|5|1

i've tried this, it's slow , still missing few results:

where (clin.clin_sig "%4%" or clin.clin_sig regexp "^5$"     or clin.clin_sig regexp "^5\\|"    or clin.clin_sig regexp "\\|5$" or clin.clin_sig regexp "\\|5\\|") , clin.clin_sig not regexp "^2$"  , clin.clin_sig not regexp "\\|2$" , clin.clin_sig not regexp "^2\\|" , clin.clin_sig not "%3%"                           

    clin_sig     regexp '^[[:<:]](4|5)[[:>:]]$' , clin_sig not regexp '^[[:<:]](2|3)[[:>:]]$' 

please provide more test cases.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -