Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Forum Dictionary / Programming / 網頁/網站程式 / JavaScript /

JS 正規化表示法做資料驗證

New Subject
Random
Previous
Next
|
JS 正規化表示法做資料驗證

身份證字號正規化驗證
  1. function checkID(string) {
  2.   re = /^[A-Z]\d{9}$/;
  3.   if (re.test(string)) return true;
  4.   }

信用卡號正規化驗證
  1. function checkCreditCard(string) {
  2.   re = /^\d{4}-\d{4}-\d{4}-\d{4}$/;
  3.   if (re.test(string)) return true;
  4.  }

英文名稱正規化驗證
  1. function checkEnglishName(string) {
  2.   re1 = /^[A-Za-z\-]+\s+[A-Za-z\-]+$/;
  3.   re2 = /^[A-Za-z\-]+\s+[A-Za-z\-]+\s+[A-Za-z\-]+$/;
  4.   if (re1.test(string) || re2.test(string)) return true;
  5.   } 

Email 正規化驗證
  1. function checkEmail(string) {
  2.   re = [url=]/^.+@.+\..{2,3}$/[/url];
  3.   if (re.test(string))return true;
  4.   }

  • Keywords : string, return, function, 正規化驗證, checkID, checkEmail, checkCreditCard, Email
0 0
2010-05-08T04:07:00+0000


  • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
Comment
 
Verify
  • Auto Platform
    For better browsing experience, it will auto detects your device to display webpage.
  • Bug Report
    Tell us about the idea, problem and errors you found.
  • Comodo Secure
    The sensitive data transmission adopts by SSL-2048 authenticated encryption.
  • Copyright
    © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
  • Revised Version
    V2.2.061
    03 Aug 2023 (GMT+8)