I want to avoid catching input as:
:):) but want to catch sa:)ds or simply want to exclude from result if there are two or more of the same tags which are touching one another.
My logic says I need to use negative lookbehind and named capture group but canot make it working and I become unsure if correct way.
I tried with:
(?<!(?P<happy>:\)))(?P=happy)
so if I have input as
:):)
--:)-abc
I want to match only from second line ":)"
If you are going to build a regex for .NET don't work with other RegEx engines to test your patterns. That said, you can benefit from variable-length lookbehinds in .NET but not PCRE (engine you're working with).
This would be a workaround in .NET:
That obviously doesn't work in regex101.com