위치와 이스케이핑

Page 3 - 앵커를 사용해 보자!

  • Source : who is who
  • Case 1
    • Regular Expression : ^who
    • First match: who is who
    • All matches : who is who
  • Case 2
    • Regular Expression : who$
    • First match: who is who
    • All matches : who is who
  • ^(캐럿)이 등장하면 캐럿 뒤의 문자가 소스 상에서 시작 위치에 있을 경우 사용됨
  • $(달러)는 소스의 끝에 위치하는 대상을 지목할 때 사용함
  • Character ^ matches the beginning of the line(case 1) while dollar sign$ the end of the line(case 2)

 

Page 4 - 특수한 문자가 포함되어 있다면? 이스케이프 문자를 사용해 보자!!!!

  • Source : $12$ \-\ $25$
  • Case 1
    • Regular Expression : ^$
    • First match: $12$ \-\ $25$
    • All matches : $12$ \-\ $25$
  • Case 2
    • Regular Expression : \$
    • First match: $12$ \-\ $25$
    • All matches : $12$ \-\ $25$
  • Case 3
    • Regular Expression : ^\$
    • First match: $12$ \-\ $25$
    • All matches : $12$ \-\ $25$
  • Case 4
    • Regular Expression : \$$
    • First match: $12$ \-\ $25$
    • All matches : $12$ \-\ $25$
  • Case 5
    • Regular Expression : \\
    • First match: $12$ \-\ $25$
    • All matches : $12$ \-\ $25$
  • If literal value of a special character is required, it must be escaped with a backslash \

 

 

'개발(레거시) > 정규 표현식 수련관(휴업)' 카테고리의 다른 글

서브 패턴  (0) 2023.07.31
특정 문자  (0) 2023.07.31
모든 문자  (0) 2023.07.30
정규 표현식 패턴 기본  (0) 2023.07.29
이하눌