리눅스 쉘 스크립트 학습 - 정규 표현식 비교

Purple·2022년 10월 13일
0

리눅스 쉘 스크립트

목록 보기
27/53

$REPLY

  • READ 명령에서 사용하는 default 변수명이다.

REGEX 비교문1

  • ^ : Beginning. Matches the beginning of the string, or the beginning of aline if the multiline flag (m) is enabled.
  • [] : Character set. Match any character in te set
  • $ : End. Matches the end of the string, or the end of a line if the multiline flag (m) is enabled.
  • ! : NOT
  • =~ : 우측항에 정규표현 패턴식을 적어 비교할 수 있게 하는 구문이다.

REGEX 비교문2

  • () : Capturing group. Groups multiple tokens together and creates a capture group for extracting a substring or using a backreference.
  • . : Dot. Matches any character except line breaks.
  • 위와 같은 상황에서, 패턴매칭이 일어나면, 위와 같이 BASH_REMATCH라는 변수에 그 결과값이 저장이 된다.
profile
안녕하세요.

0개의 댓글