js regular defined Alipay account number, phone number, email

A, Alipay account: can only enter numbers, letters, letters (numbers) + number (alphabet), wherein only the letter may contain @, _ or also all three may be included and may be in any position, limits: less 30 (according to the needs custom range):

  let  zhfubao = /let inputAccount = /(^[a-zA-Z0-9_.@]{0,30}$)|(^(?=\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$).{0,30}$)/

Second, the phone number: only beginning with the number 1,

  let phone = /^[1][3,4,5,6,7,8,9][0-9]{9}/

Third, the email account:

  let email = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/

Follow-up may add other rules, Guestbook comments that wrong!

Guess you like

Origin www.cnblogs.com/Z_66/p/12174676.html