正则表达式匹配包含(一个或多个)强制和允许字符的整个单词

eff*_*ffe 1 php regex

我希望匹配包含至少一个强制字符和允许字符的整个单词.

例如
强制字符是:[t,a,x]
允许的字符是:[i,e]

t     : passed (one of mandatories are here)
tea   : passed (two of mandatories(t,a) and one allowed(e) here)
e     : failed (none of mandatory is here)
teas  : failed (two of mandatories(t,a) and one allowed(e) here but one intruder(s))
Run Code Online (Sandbox Code Playgroud)

什么是适当的REGEX代码?它将用于搜索12.000行的MySQL表,每行包含一个单词作为PHP项目.

Tho*_*mas 6

让我帮助你自己,而不是给出一个直接的答案.通过的单词由以下序列组成:

  • 零个或多个允许或强制字符
  • 强制性角色
  • 零个或多个允许或强制字符

为这些中的每一个写正则表达式,然后将它们连接起来以获得整个事物的正则表达式.