I am trying to update three regular expressions to identify patterns in git logs. Basically, they are expressions for identifying code line additions, modifications, and deletions from git annotations when running the git diff ---word-diff --unified=0
command.
The expressions are:
MODIFICATION: .+(\[-|\{\+).*$
ADD: \{\+.*\+\}$
REMOVE: \[-.*-\]$
Originally, these expressions were presented in this question: Is there a way of having git show lines added, lines changed and lines removed?. But today, apparently, they are no longer working as they should, because when testing here, I found different numbers than they really should have
For the following code, it introduced different numbers of removals and modifications:
@@ -11 +11 @@ delta dAddressBook {
private String [-addressA;-]{+address;+}
@@ -13 +13 @@ delta dAddressBook {
public [-AddressBookEntryB()-]{+AddressBookEntry()+} {
@@ -39,0 +40,4 @@ delta dAddressBook {
{+public void setAddress(String address) {+}
{+ this.address = address;+}
{+ }+}
@@ -45,2 +48,0 @@ delta dAddressBook {
[- import br.unb.cic.iris.core.exception.EmailException;-]
[- import br.unb.cic.iris.core.model.AddressBookEntry;-]
On https://regex101.com/r/Soeey3/1/
For some reason, it is matching line 7 in this example ({+public void setAddress(String address) {+}
), where this line should be accounted for addition and not modification. Similarly, the expression for addition does not match line 7.