regex error
Jabba Laci
jabba.laci at gmail.com
Sun Nov 23 12:43:05 UTC 2025
I'm working on an Advent of Code problem (2015, Day 5, Part 2),
and my code doesn't work in D. In Python I get the correct result.
Here is a string:
const s = "xdwduffwgcptfwad";
The instructions says: "It contains a pair of any two letters
that appears at least twice in the string without overlapping,
like xyxy (xy) or aabcdefgaa (aa), but not like aaa (aa, but it
overlaps)."
Here, "fw" appears twice. My D code:
auto m1 = matchFirst(s, regex(r"(..).*\1"));
returns an empty m1 object. What am I doing wrong? The same regex
works in Python.
More information about the Digitalmars-d-learn
mailing list