Open oxinabox opened 4 years ago
See also findnext
and findprev
, which are respectively consistent with findfirst
and findlast
.
I'm not sure it's possible to get the last match of a regex with PCRE. That question may not be well-defined, as one can also write a regex to extract the last match of an expression, and pass that to findfirst
. Of course as a brute-force method we could have findlast
return last(findall(...))
, but that's not a good implementation.
Yes, PCRE doesn't support reverse-order searching. (You can simulate by reversing the string and searching with a reversed regex, but automatically constructing a reversed regex in general seems to be a hard problem.)
findfirst
,findlast
andfindall
each support a different set of needles when the haystack is anAbstractString
.We should make them consistent