Re: find regex in backward direction ?

2020-12-19 Thread Виталий Фадеев via Digitalmars-d-learn
On Sunday, 20 December 2020 at 04:33:21 UTC, Виталий Фадеев wrote: On Saturday, 19 December 2020 at 23:16:18 UTC, kdevel wrote: On Saturday, 19 December 2020 at 12:52:54 UTC, Виталий Фадеев wrote: ... "retro" possible when using simple expression "abc". For complex "ab\w" or "(?Pregex)" shoul

Re: find regex in backward direction ?

2020-12-19 Thread Виталий Фадеев via Digitalmars-d-learn
On Saturday, 19 December 2020 at 23:16:18 UTC, kdevel wrote: On Saturday, 19 December 2020 at 12:52:54 UTC, Виталий Фадеев wrote: Goal: size_t pos = findRegexBackward( r"abc"d ); assert( pos == 4 ); module LastOccurrence; size_t findRegexBackward_1 (dstring s, dstring pattern) { i

Re: find regex in backward direction ?

2020-12-19 Thread kdevel via Digitalmars-d-learn
On Saturday, 19 December 2020 at 12:52:54 UTC, Виталий Фадеев wrote: Goal: size_t pos = findRegexBackward( r"abc"d ); assert( pos == 4 ); module LastOccurrence; size_t findRegexBackward_1 (dstring s, dstring pattern) { import std.regex : matchAll; auto results = matchAll (s, pat

find regex in backward direction ?

2020-12-19 Thread Виталий Фадеев via Digitalmars-d-learn
We have: dstring s = "abc3abc7"; Source: https://run.dlang.io/is/PtjN4T Goal: size_t pos = findRegexBackward( r"abc"d ); assert( pos == 4 ); How to find regex in backward direction ?