Regex for matching all words in any order and if any word is missing in the string, it will not return any result.
e.g.
str = "You’re ready to ask a programming-related question and this form will help guide you through the process.
If our requirement is to find the match if str contains both words 'ready' & 'question` in any order, then the pattern would be:
/\bready\b.*\bquestion\b/gi
or /\bready\b.*\bquestion\b|\bquestion\b.*\bready\b/gi
.
But let's say we need to find a result that contains another word like 'post' along with 'ready' & 'question' then the pattern will not return the match since the word 'post' is not present in the 'str'.
the pattern I was trying
str = 'Then Lord of the Rings: The Return of the King' pattern = /(\b(the|king|of)\b)/gi