From 8c505846ec60f9d2e747914a1a3ec851f41d6eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 21 Nov 2018 14:29:33 +0100 Subject: [PATCH] Regex --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 91e89d3..9a528b4 100644 --- a/README.md +++ b/README.md @@ -190,12 +190,12 @@ print( [, , end='', sep='', file=]) # Use 'file=sys.stderr' for e ### Regex ```python import re - = re.sub(, new, text, count=0) # Substitutes all occurrences. + = re.sub(, new, text, count=0) # Substitutes all occurrences. = re.findall(, text) - = 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 string. - = re.finditer(, text) # Searches for all occurences of pattern. + = 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 string. + = re.finditer(, text) # Searches for all occurences of pattern. ``` * **Use '.group()' method on Match object it to get the whole match, or '.group(1)' to get the part in first bracket.**