w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
match string in any word order regex

You'll want to use positive lookahead ?=.*.

[Positive lookahead]q(?=u)matches a q that is followed by a u, without making the u part of the match. The positive lookahead construct is a pair of parentheses, with the opening parenthesis followed by a question mark and an equals sign.

Positive lookahead can be used in this circumstance to match a set of patterns in any order, like so:


expression visualization

Debuggex Demo Here

To modify, just add, edit or remove words as you see fit.


Found a question that explains the same concept here: http://stackoverflow.com/a/3533526/2081889

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.