I think I found a better regex syntax.
After the TLD we are trying to block we are using [^a-zA-Z0-9_] which says:
[^a-zA-Z0-9_] match a single character not present in the list below
a-z a single character in the range between a and z (case sensitive)
A-Z a single character in the range between A and Z (case sensitive)
0-9 a single character in the range between 0 and 9
_ the literal character _
I added a period after the caret ^ and it changed it to mean:
[^.a-zA-Z0-9_] match a single character not present in the list below
. the literal character .
a-z a single character in the range between a and z (case sensitive)
A-Z a single character in the range between A and Z (case sensitive)
0-9 a single character in the range between 0 and 9
_ the literal character _
So now the string "[email protected]" is not a valid match but "[email protected]" is caught.
I will test this on a few of the more popular "false positive domains" and let you know what happens.
I tested it at regex101.com using the javascript tester. All I used in the Regular Expression was "[email protected]+\.lawyer[^.a-zA-Z0-9_]" (no quotes) against the test string "[email protected]" and "[email protected]" (no quotes)
Hope this helps
After the TLD we are trying to block we are using [^a-zA-Z0-9_] which says:
[^a-zA-Z0-9_] match a single character not present in the list below
a-z a single character in the range between a and z (case sensitive)
A-Z a single character in the range between A and Z (case sensitive)
0-9 a single character in the range between 0 and 9
_ the literal character _
I added a period after the caret ^ and it changed it to mean:
[^.a-zA-Z0-9_] match a single character not present in the list below
. the literal character .
a-z a single character in the range between a and z (case sensitive)
A-Z a single character in the range between A and Z (case sensitive)
0-9 a single character in the range between 0 and 9
_ the literal character _
So now the string "[email protected]" is not a valid match but "[email protected]" is caught.
I will test this on a few of the more popular "false positive domains" and let you know what happens.
I tested it at regex101.com using the javascript tester. All I used in the Regular Expression was "[email protected]+\.lawyer[^.a-zA-Z0-9_]" (no quotes) against the test string "[email protected]" and "[email protected]" (no quotes)
Hope this helps