I want to reduce the number of patterns that I need to write using a regular expression that matches any or all of the patterns when it appears in a string.
Is this possible with Regex?
E.g. Pattern is: "the cat sat on the mat"
I would like pattern to match on following strings:
"the"
"the cat"
"the cat sat"
...
"the cat sat on the mat"
But it should not coincide with the next line, because although some words correspond to each other, they are separated by an inappropriate word: "the dog was sitting"
mrblack
source
share