리눅스 쉘 스크립트 학습 - 정규 표현식 비교
$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라는 변수에 그 결과값이 저장이 된다.