就像是
杰克和詹姆斯
同意以下字符串
>’hi jack here is james’>’hi james here is jack’
^(?=.*\bjack\b)(?=.*\bjames\b).*$
Test it.
这种方法的优点是可以轻松指定多个条件。
^(?=.*\bjack\b)(?=.*\bjames\b)(?=.*\bjason\b)(?=.*\bjules\b).*$