| 양쪽 이전 판이전 판다음 판 | 이전 판 |
| javascript:regexp [2019/01/25 04:47] – [Password] taekgu | javascript:regexp [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 |
|---|
| ===== Javascript RegExp ===== | ===== Javascript RegExp ===== |
| | |
| | <code jsvascript> |
| | function funRegComma(param){ |
| | var num = '' +param; |
| | var reg = /(^[+-]?\d+)(\d{3})/; |
| | while(reg.test(num)){ |
| | num = num.replace(reg,'$1' + ',' + '$2'); |
| | } |
| | return num; |
| | } |
| ==== Password ==== | ==== Password ==== |
| 비밀번호 체크하기 위한 RegExp | 비밀번호 체크하기 위한 RegExp |
| </code> | </code> |
| ^RegEx ^Description^ | ^RegEx ^Description^ |
| |\^ |The password string will start this way| | |''^'' |The password string will start this way| |
| |(?=.*[a-z]) |The string must contain at least 1 lowercase alphabetical character| | |(?=.*[a-z]) |The string must contain at least 1 lowercase alphabetical character| |
| |(?=.*[A-Z]) |The string must contain at least 1 uppercase alphabetical character| | |(?=.*[A-Z]) |The string must contain at least 1 uppercase alphabetical character| |
| |(?=.*[0-9]) |The string must contain at least 1 numeric character| | |(?=.*[0-9]) |The string must contain at least 1 numeric character| |
| |(?=.[!@#\$%\^&]) |The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict| | |(?=.[!@#\$%\''^''&]) |The string must contain at least one special character, but we are escaping reserved RegEx characters to avoid conflict| |
| |(?=.{8,}) |The string must be eight characters or longer| | |(?=.{8,}) |The string must be eight characters or longer| |
| | | | | |
| |
| ==== 전화번호 ==== | ==== 전화번호 ==== |
| mySheet1.SetColHidden("detail",false);//type="Html" 보이기. | mySheet1.SetColHidden("detail",false);//type="Html" 보이기. |
| </h5:Action> | </h5:Action> |
| | ==== 숫자의 콤마표현 ==== |
| | <code javascript> |
| | function numberWithCommas(x) { |
| | //sumVal = sumVal.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ","); //IE에서 오류 |
| | return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ","); |
| | } |
| | </code> |
| | ==== 시분표현 ==== |
| | <code javascript> |
| | //시분포멧 (12:00) 체크 |
| | var timeFormat = /^([01][0-9]|2[0-3]):([0-5][0-9])$/; |
| | //숫자 네자리(0000) 체크 |
| | var timeFormat2 = /^([01][0-9]|2[0-3])([0-5][0-9])$/; |
| | </code> |