Added support for hyphen(-) under email regex by hiteshbedre · Pull Request #543 · Tencent/APIJSON

Conversation

@hiteshbedre

Current version of email regex don't have support for hyphen(-). I have updated the existing regex which has duplicate slash symbol twice in first square bracket, which is redundant.

Executed some test cases here: https://regex101.com/r/qiNqNc/1

@TommyLemon

thx for ur contribution! besides, i got a good tool for testing regular expressions because of ur mention above~

@TommyLemon

btw, after i typed

tommy@qq.com
lemon-31@gmail.com

in the left input area, it shows that the 2 lines don't match the regular expression above.

then i modified the lines to:

tommy@XX\XXX\
lemon-31@XX\XXX\

it shows they matched.

is there anything wrong?

image

@hiteshbedre

@TommyLemon

@hiteshbedre

Absolutely, plus we can completely change the email regex to validate ".com" part within regex itself. Happy to do it.

2 participants

@hiteshbedre @TommyLemon