메모장 입니다2

정규표현식 practice [lesson 1 ~ lesson 10] 본문

Study/Programming

정규표현식 practice [lesson 1 ~ lesson 10]

Wooum@n 2019. 5. 9. 18:33

1. 튜토리얼

https://regexone.com/   

 

<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.연습 사이트

https://regexr.com/

 

 

'Study > Programming' 카테고리의 다른 글

공개SW] Go Language - day 1  (0) 2019.07.15
Python] Asterisk (variable argument )  (0) 2019.05.26
Python] 문자열 자르기  (0) 2018.09.30
codility] Nesting  (0) 2018.02.05
codility] Fish  (0) 2018.02.04