zahlenGraph
zahlenGraph

Reputation: 15

mysql negative lookahead for a group of letters

I'm looking for a mysql regexp that takes any 3letter combinations except 'BCN', 'LED' and 'ATH'. I've been trying

'[^?=BCN|LED|ATH]'

(and many many others in vain!) but this also excludes combinations like 'ACE' or 'BCB'. Unfortunately it seems to me that '?!' is not working in mysql. Any help appreciated!

Upvotes: 0

Views: 652

Answers (1)

Eily
Eily

Reputation: 141

If you only have three forbidden words, you can write the basic version:

'[^BLA]..|B([^C].|C[^N])|L([^E].|E[^D])|A([^T].|T[^H])'

Debuggex Demo

Upvotes: 1

Related Questions