정규표현식 practice [lesson 1 ~ lesson 10]
1. 튜토리얼
<lesson 1>
-\d: the character \d can be used in place of any digit from 0 to 9
<lesson 2>
- . : match any single character
\. : match the period character
<lesson 3>
- [abc] : by defining them inside square brackets,
the pattern [abc] will only match a single a, b, or c letter and nothing else.
<lesson 5>
-\d: the character \d can be used in place of any digit from 0 to 9
-the pattern [0-6] will only match any single digit character from zero to six, and nothing else. And likewise, [^n-p] will only match any single character except for letters n to p.
<lesson 6>
-{}: to specify how many repetitions of each character we want.
-for example w{3}(three w's), [wxy]{5} (five characters, each of which can be a w, x, or y)
and .{2,6} (between two and six of any character).
<lesson 7>
-*, +: represents either 0 or more or 1 or more of the character that it follows
(it always follows a character or group)
- for example a+(one or more a's), [abc]+ (one or more of any a, b, or c character) and .* (zero or more
of any character).
<lesson 8>
- ?: allows you to match either zero or one of the preceding character or group.
- For example, the pattern ab?c will match either the strings "abc" or "ac" because the b is considered optional.
- \?: to match a plain question mark character.
<lesson 9>
- regular expressions are the space(␣), the tab (\t), the new line (\n) and the carriage return (\r)
- \s: match any of the specific whitespaces
<lesson 10>
-^ (hat) and $ (dollar sign): to define a pattern that describes both the start and the end of the line
-^success to match only a line that begins with the word "success", but not the line "Error: unsuccess
ful operation".
2.연습 사이트