Alex Rivera | Logout

Regex to match string containing two names in any order

Asked 2010-12-08T16:13:33.700
324

I need logical AND in regex.

something like

jack AND james

agree with following strings

  • 'hi jack here is james'

  • 'hi james here is jack'

Edit
Report

1 Answer

9

You can do:

\bjack\b.*\bjames\b|\bjames\b.*\bjack\b
answered 2010-12-08T16:16:25.693

Your Answer