From 77d6245da56f912c524de5004f8d0da41d5db408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 29 Mar 2019 03:05:41 +0100 Subject: [PATCH] Regex --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3e4bc8f..1937ab6 100644 --- a/README.md +++ b/README.md @@ -287,12 +287,12 @@ Regex ----- ```python import re - = re.sub(, new, text, count=0) # Substitutes all occurrences. - = re.findall(, text) # Returns all occurrences. - = re.split(, text, maxsplit=0) # Use brackets in regex to keep the matches. - = re.search(, text) # Searches for first occurrence of pattern. - = re.match(, text) # Searches only at the beginning of the text. - = re.finditer(, text) # Returns all occurrences as match objects. + = re.sub('', new, text, count=0) # Substitutes all occurrences. + = re.findall('', text) # Returns all occurrences. + = re.split('', text, maxsplit=0) # Use brackets in regex to keep the matches. + = re.search('', text) # Searches for first occurrence of pattern. + = re.match('', text) # Searches only at the beginning of the text. + = re.finditer('', text) # Returns all occurrences as match objects. ``` * **Parameter `'flags=re.IGNORECASE'` can be used with all functions.** @@ -312,9 +312,9 @@ import re ### Special Sequences **Expressions below hold true for strings that contain only ASCII characters. Use capital letters for negation.** ```python -'\d' == '[0-9]' # Digit -'\s' == '[ \t\n\r\f\v]' # Whitespace -'\w' == '[a-zA-Z0-9_]' # Alphanumeric +'\d' == '[0-9]' # Digit +'\s' == '[ \t\n\r\f\v]' # Whitespace +'\w' == '[a-zA-Z0-9_]' # Alphanumeric ```