The regular expression does not contain the string matches the containing string

Does not contain the string ABC:
^(?!.*ABC).*$
(Reference: https://www.cnblogs.com/wangqiguo/archive/2012/05/08/2486548.html )

Does not contain the string ABC and contains the string XYZ:
^((?!ABC).)*XYZ((?!ABC).)*$
(Reference: https://www.cnblogs.com/mumian2/p/10926361 .html )

Guess you like

Origin blog.csdn.net/hegan2010/article/details/104988396