Regex AND – Line has to match multiple expressions

We need to mimic “AND” functionality using look ahead expression (?=expr). See the construct below: ^(?=.*?expr)(?=.*?expr)(?=.*?expr).*$ This functionality works in Java/Phyton/Perl/PHP and many other languages, however it might not be available in...

Regex – Select lines not containing a word

Select a line not containing “2D” string would look something like that: ^((?!2D).)*$ If you would like to select a lice which contains a phase or patern you would use the fallowing expresion: .*(2D).* In the first example, we use negative look ahead...

MySQL – Regular expression replace

As of MySQL 8.0 and MariaDB 10 we can use  native REGEXP_REPLACE function. See also See MariaDB docs and PCRE Regular expression enhancements. — REGEXP_REPLACE(col, regexp, replace) SELECT REGEXP_REPLACE(“stackoverflow”,...