I am working on a regex which would return true if matched words are present in any order.
This approach (discussed here: Regular Expressions: Is there an AND operator?)
(?=.*tag1)(?=.*tag2)
matches both tag1 tag2 and tag2 tag1 (http://rubular.com/r/374706hkft), in Ruby, but does not work in JavaScript. Any ideas?
Edit: by "Does not work in JS" I meant that
"tag1 tag2".match(/(?=.*tag1)(?=.*tag2)/)
returns [""].
The answer to this question pointed out that the regex works in the format of
/(?=.*tag1)(?=.*tag2)/.test("tag1 tag2")