I have js code:
/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/
But what's the point [_|\_|\.]? (js regexp)
[_|\_|\.]
If we use a resource like Regexper , we can visualize this regular expression:
From this we can conclude that [_|\_|\.]requires one of the "_", "|" or ".". We also see the double declaration "_" and "|" not required. As a HamZa comment , this segment can be shortened to [_|.]achieve the same result.
[_|.]
, , Regexper, .
, .. .
[|_.]
REGEX101 -
Char class [_|\_|\.] 0 to 1 times [greedy] matches: [_|\_|\. One of the following characters _|_|. [_|\_|\.] requires one of either "_", "|" or "."
. RegEx101
[_|\_|\.], , (_) (.) [_.].
_
.
[_.]
, (|) "" (.. alternation), . , , , . .
|
(.) - , , . , , . ; , , .
, ? . , , . , - , ( ), - , . :
?
[a-zA-Z0-9]+([_.][a-zA-Z0-9]+)*
- , _ ., . , , . , , , , . , , , , . , , .