我有一个字符串,其中有效条目是's''a''t'或'b'或字符串'all'。我想知道该条目何时无效。似乎需要否定来测试错误的字符串。结果应该是:
preg_match('/[^satb(all)]/', 's') ==> should be false (and is)
preg_match('/[^satb(all)]/', 'sall') ==> should be false (and is)
preg_match('/[^satb(all)]/', 'alsl') ==> should be true but is not (the l's are not part of 'all')
我尝试了许多不同的组合,但我无法做到正确。在此先感谢您的帮助。