0. A truth for the regular expression
Regular expression is used to matching pattern in a line. (Not laid on multiple lines.)
1. The Structure of a regular expression
1) Anchors
(1) ^ : begin of a line
(2) $ : end of a line
(3) \< ... \> : word level matching.
2) Character sets
(1) . : any char except the EOL char.
(2) [...] : any char in brackets.
a. range : [a-z], [0-9], [A-Za-z0-9_]
b. order : "^T[a-z][aeiou] " : Tha, The, Thi, ...
(3) [^...] : negate pattern. except chars in brackets.
(4) \( ... \) : remembered pattern. use it with "\1 ~ \9"
3) Modifiers : follows a character set. if not, not a modifier.
(1) * : 0 or more copies
(2) {a,b} : # of copies between a and b.
댓글 없음:
댓글 쓰기