Whether you have something like " example@mail.com (A, B)" or like this ((A, B) example@mail.com ", all you have to do is have the first and last part the only capture records. Therefore (A, B) should be automatically excluded to capture the regular expression.
If this is not a problem, you can always take the text returned by the regular expression and use replace to change (A, B) to nothing like this:
var regexresult=str.replace("(A,B)","");
This code will delete the line if it is present, otherwise it will do nothing.
source share