Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| public:computer:regexp [2021/12/31 16:17] – [자주 쓰는 정규표현식] alex | public:computer:regexp [2023/01/01 00:58] (current) – [선택, 그룹, 역참조] alex | ||
|---|---|---|---|
| Line 70: | Line 70: | ||
| ==== 참조 그룹 ==== | ==== 참조 그룹 ==== | ||
| - | * 찾고자 하는 내용을 ()로 감싼 후(참조) $1, $2 혹은 \1, \2와 같이 역참조 | + | * 찾고자 하는 내용을 ()로 감싼 후(참조) |
| Line 126: | Line 126: | ||
| * 서브패턴 ex) (the|The|THE), | * 서브패턴 ex) (the|The|THE), | ||
| - | * 그룹 참조와 역참조; \1, $1 | + | * 그룹 참조와 역참조; \1, \$1 |
| * 그룹 이름 지정; ?< | * 그룹 이름 지정; ?< | ||
| - | * 그룹 이름으로 참조; $+{one}, $+{two} | + | * 그룹 이름으로 참조; |
| ^ 그룹 이름 지정 구문 | ^ 그룹 이름 지정 구문 | ||
| Line 260: | Line 260: | ||
| * 숫자만으로만 되어있는지 확인; <alert type=" | * 숫자만으로만 되어있는지 확인; <alert type=" | ||
| * 첫글자만 보이게 마스킹; <alert type=" | * 첫글자만 보이게 마스킹; <alert type=" | ||
| - | * Password Validataions< | + | * Password Validataions |
| public static Boolean hasSpecialCharacter(String strPassword) | public static Boolean hasSpecialCharacter(String strPassword) | ||
| Line 388: | Line 388: | ||
| }</ | }</ | ||
| - | * camelCase to snake_case and MACRO_CASE <sxh java title: | + | * camelCase to snake_case and MACRO_CASE |
| public static String getSnakeCaseFromCamelCase(String strCamelCase) | public static String getSnakeCaseFromCamelCase(String strCamelCase) | ||
| { | { | ||
| Line 398: | Line 398: | ||
| return strCamelCase.replaceAll(" | return strCamelCase.replaceAll(" | ||
| } | } | ||
| + | </ | ||
| + | * Card Number Validation (TypeScript)< | ||
| + | function validateIBKCEOCard(strCardNumber: | ||
| + | const regDigitsOnly = /(\D+)/gi | ||
| + | const strDigits = strCardNumber.replace(regDigitsOnly, | ||
| + | |||
| + | if (strDigits.length != 16) { | ||
| + | console.log(strCardNumber + ' is invalid card number' | ||
| + | return | ||
| + | } | ||
| + | | ||
| + | console.log(' | ||
| + | |||
| + | const regValidate: | ||
| + | const bValid = regValidate.test(strDigits) | ||
| + | |||
| + | console.log(' | ||
| + | } | ||
| </ | </ | ||
| Line 442: | Line 460: | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | |||