We can use \number
to "Matches the contents of the group of the same number" in Python. See Python re doc.
For example:
There are two strings:var abc=123; abc=234;
and var abc=123; xyz=234;
.
I want to capture the first one but not the second.
We can use var\s+(\w+)\s*=\s*\d+\s*;\s*\1\s*=\s*\d+\s*;
to do this in Python.
Now the question is how to do this in Golang?