Hi @guy038,
Thanks for sending “A01466.headed.xml.txt”.
Confirming your findings with some additions, note the influence of “wrap around”.
Tested on a Desktop running Windows XP Home + Sp3 with Windows Classic GUI ;-)
Need to get my Windows 10 x64 ready to be able to dig in and debug this!
Regex A: (?si)(?<=\W)(man_n)((?:\W+\w+){0,50}\W+)(city_n)(?=\W)|(?<=\W)(?3)(?2)(?1)(?=\W)
and
Regex B: (?si)(?<=\W)man_n(?:\W+\w+){0,50}\W+city_n(?=\W)|(?<=\W)city_n(?:\W+\w+){0,50}\W+man_n(?=\W)
and
Regex D: (?si)(?<=\W)city_n(?:\W+\w+){0,50}\W+man_n(?=\W)|(?<=\W)man_n(?:\W+\w+){0,50}\W+city_n(?=\W)
Pass i.e. one match even after repeated search:
Find w/ wrap around;
Using RegexTester (by
@Claudia-Frank);
Using RegexBuddy w/ boost::regex 1.58-1.59 ECMAScript (default) flavor
FAIL:
Find w/o wrap around - “Can’t find text”
Regex C: (?si)(?<=\W)(city_n)((?:\W+\w+){0,50}\W+)(man_n)(?=\W)|(?<=\W)(?3)(?2)(?1)(?=\W)
and
Regex G: (?i)(?(DEFINE)(\bcity_n\b)((?:\W+\w+){0,50}\W+)(\bman_n\b))(?1)(?2)(?3)|(?3)(?2)(?1)
Pass i.e. one match even after repeated search:
Using RegexTester (by
@Claudia-Frank);
Using RegexBuddy w/ boost::regex 1.58-1.59 ECMAScript (default) flavor
FAIL:
Find w/ wrap around - toggles between two matches on repeated search (partial and complete text);
Find w/o wrap around - “Can’t find text”
Regex E: (?i)(?(DEFINE)(\bcity_n\b)((?:\W+\w+){0,50}\W+)(\bman_n\b))(?<=\W)(?1)(?2)(?3)(?=\W)|(?<=\W)(?3)(?2)(?1)(?=\W)
and
Regex F: (?i)(?(DEFINE)(\bcity_n\b)((?:\W+\w+){0,50}\W+)(\bman_n\b))(?<=\W)(?:(?1)(?2)(?3)|(?3)(?2)(?1))(?=\W)
Pass i.e. one match even after repeated search:
Using RegexTester (by
@Claudia-Frank);
Using RegexBuddy w/ boost::regex 1.58-1.59 ECMAScript (default) flavor
FAIL:
Find w/ wrap around - toggles between two matches on repeated search (partial and complete text);
Find w/o wrap around - toggles between two matches on repeated search (complete text and “Can’t find text”)
Regards,
Menno