Regular expression about email address

xiaoxiao2021-03-06  59

The most basic format of the email address can be seen as the . For the user name, each ISP has no uniform standard. In addition to the numbers and letters, some allowed <_>, some allowed to be <.>, There are both, or allow other special characters. In this regard, we can only judge according to the specific situation. In the text, it is assumed that it is allowed to be in addition to the letter and the figures, <_> cannot appear in the first place, <.> <_> Cannot be connected. Digital and alphabeties in the domain name are allowed to appear <->, and <-> cannot appear in the first bit and the last position, each paragraph is used <.> Connection. We can also learn from the domain name greater than one bit and only letters. Below we can use the following expression to determine if the string is an email address: ^ ([A-Z0-9A-Z] [- | /.]?) [A-Z0-9A- Z] @ ([A-Z0-9A-Z] (- [A-Z0-9A-Z] )? /.) [A-ZA-Z] {2,} $ slightly explained: ^: Match start ([A-Z0-9A-Z] [- | /.] 1 digits <-> or <.>, The above combination repeats more than 1 time [A-Z0-9A -Z]: The username is ending with numbers or letters @: Match <@> ([A-Z0-9A-Z] : Match multiple digits or letters (- [A-Z0-9A-Z] )? Matching - plus multiple digits or letters 0 times or 1 time / .: match <.>) : Match in parentheses [A-ZA-Z] {2,}: Matching letters 2 times or more $: matching end The test can be achieved. I just learned a regular expression, please ax.

转载请注明原文地址:https://www.9cbs.com/read-113476.html

New Post(0)