You need a regular expression that checks whether the text contains words - qwe , asd , zxc , they can be part of the word. If done in order qwe.*asd.*zxc.* , It is possible through | List all possible variants of sequences, and how to make this task easier?

Type:

 SELECT 'Π½Π°Π±ΠΎΡ€ симовлов' REGEXP 'рСгулярноС Π²Π°Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅'; 

    3 answers 3

    I need them all to meet

     (?=.*qwe)(?=.*asd)(?=.*zxc) 
    • SELECT 'qweasdzxc' REGEXP '(? =. * Qwe) (? =. * Asd) (? =. * Zxc)'; Issued error 1139. Am I doing something wrong? Thanks a lot for your help! - Egor_K
    • I think I need to write a concise expression. Thanks for editing my question, it’s so much clearer. I found a similar task (their regular expression does not work in mysql): ru.stackoverflow.com/questions/416913/… - Egor_K
    • @Egor_K, perhaps, mysql does not know how to preview. - Qwertiy ♦
    • Thank! I had such a suspicion, because in the manuals for regular expressions in MYSQL there are a lot less commands than just regular expressions. I thought I just misunderstood something in the directories! - Egor_K

    something like this (will return 1 if one of the combinations matches):

     select 'Π½Π°Π±ΠΎΡ€ симовлов' regexp 'qwe|asd|zxc'; 

    and if you want the string to have all three combinations, then something like this:

     select 'Π½Π°Π±ΠΎΡ€ симовлов' regexp 'qwe' and 'Π½Π°Π±ΠΎΡ€ симовлов' regexp 'asd' and 'Π½Π°Π±ΠΎΡ€ симовлов' regexp 'zxc'; 
    • qwe | asd | zxc I need them all to meet necessarily, and not 1 of them. - Egor_K
    • That is, there is each of them (qwe + asd + zxc), but in any order. - Egor_K
    • @Egor_K added the answer. - aleksandr barakin

    Regulars here are not needed for nothing.
    Check whether the field contains a substring, you can operator LIKE. Conditions in the WHERE can be any number.
    If it is necessary that they are all executed, then they must be listed through AND

    • But I have a procedure that binds the data from the file with the master data. The check goes through several fields (in the problem one of them) in various combinations. Therefore, through where does not work. - Egor_K
    • But thanks anyway for the answer! - Egor_K