For example, how could I check if a string contains 'red', 'green' and 'blue'? (each at least once)
The only way I could think of was something like this: (checking for all possible orders)
Code: Select all
preg_match("/(red.*green.*blue|red.*blue.*green|green.*red.*blue|green.*blue.*red|blue.*red.*green|blue.*green.*red)/",$s);