A python requirements.txt file is invalid if it has different versions for the same package, represented as the lines bellow (the file is assumed to be sorted):
agate==1.6.0
agate==1.7.0
I'm trying to write a regex to detect duplicated packages (not lines as versions can differ).
My capturing group is is represented by ^([^=]+)==.+$
. Removing duplicated lines is close to the solution as it uses a back reference for last line, but my back reference would be only for the capturing group, not for the whole line.