Tried solving today's #adventofcode using only regex, and it turns out that it's not easy to match a string containing any character consecutively repeated exactly 2 times (but no more).
For example, I want to match "abccd", but not "abcccd".
Finally, I tried matching the character in the lookbehind, and while this kind of thing works for a positive lookbehind, e.g. this matches any letter preceeded by itself:
It does not work for negative lookbehind. This does not match anything:
@ihabunek this would have been my first thought
@hirojin I did think of something similar, but [\1] matches character with ASCII code 1 (base 80), and not the backref. E.g. [\80] would match 0.
As far as I can tell, it's not possible to use back-references in square brackets.
Server run by the main developers of the project It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!