0
$\begingroup$

Given a regular expression, the ask is to find all matches in a string, str. Most implementations give longest match only. For example, [\d]* in str "123456", the regex libraries in C++ or python only provide the longest match, i.e. { "123456", "" } at position 0 and 6 respectively, and that too after iterating over the string matches. , How can one obtain all matches like { "" , "1", "12", "123", "1234", "12345", "23456","2","23","234", "2345","23456", ... and so } with C++ regex libraries.

$\endgroup$
1
  • $\begingroup$ What's the context where you encountered this question? Can you credit the original source? $\endgroup$ – D.W. Oct 25 '20 at 2:47