[regex] PHP 정규표현식 패턴 15강 - 수량자 ─ { } (중괄호) - 문자 반복 횟수 특정
2,168
패턴 15 - { } (중괄호) - 문자 반복 횟수 특정
{a} : 딱 a숫자만큼 해당 - Case 1 {a,b} : 최소 a, 최대 b 숫자까지 해당 - Case 2 {a,} : 최소 a 숫자 이상이면 해당 - Case 3
Source
One ring to bring them all and in the darkness bind them |
Case 1 - 어떠한 문자든 5개씩 반복
Regular Expression: |
.{5} |
---|
First match: |
One ring to bring them all and in the darkness bind them |
---|
All matches: |
One ring to bring them all and in the darkness bind them
|
---|
Case 2 - 소문자 e , l , s 조합으로 최소1 최대 3개씩 반복
Regular Expression: |
[els]{1,3} |
---|
First match: |
One ring to bring them all and in the darkness bind them |
---|
All matches: |
One ring to bring them all and in thedarkness bind them |
---|
Case 3 - 소문자 a ~ z 중 최소 3글자 이상씩 반복
Regular Expression: |
[a-z]{3,} |
---|
First match: |
One ring to bring them all and in the darkness bind them |
---|
All matches: |
One ring to bring them all and in thedarkness bind them |
---|
코딩동강 관련글
HTML 관련글
CSS 관련글
JavaScript 관련글
JQuery 관련글
PHP 관련글
SQL 관련글
Bootstrap 3 관련글
Bootstrap 4 관련글
|