Answer the question
In order to leave comments, you need to log in
How can regexp find all occurrences of a substring if some overlap with those already found?
There is a text. I want to find all combinations of two words
that are next to each other and are separated by something (a space), and that the second word is 3 characters long or more.
I wrote down the regular expression
\S+\W+?\S{3,}
I
check: https://regex101.com/r/m8GiSB/1
For the text "Toaster" is a highly specialized question and answer service, ..."
I get entries: 1. "
Toaster
" is
2. a highly specialized service
3. questions and answers,
...
But I also need these:
4. it is a highly specialized
5. question service
and return to the previous space? To find all combinations of standing two words in a row.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question