[^AZ] Just means any symbol that is not capital A through capital Z.
. Means any character you must use \. Since it means a letter symbol .
The character group is [] , and the reverse is [^] , then you put the characters you want to match.
However, your regular expression looks like it will only match one character that is not a capital letter, then any character, then another character that is not a capital letter
You want to use the following:
[^AZ]+\.[^AZ]+
+ in regular expression means matching with the specified 1 to infinity.
If you have only this text and no other text, you should include the beginning of the line and the end of the line so that it does not correspond to long lines that include something formatted as you mentioned.
However, your regex also matches spaces and tabs.
Therefore, I would use the following:
^[^AZ\s]+\.[^AZ\s]+$
Regex Demo only works with lowercase
Regex Demo error because username is uppercase
source share