From e08ed0a4986ec88a231fe9546a7e2e50ccc81bd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Fri, 13 Dec 2019 02:26:22 +0100 Subject: [PATCH] Regex --- README.md | 4 ++-- index.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b02c1d3..44b2f5b 100644 --- a/README.md +++ b/README.md @@ -351,8 +351,8 @@ Regex ----- ```python import re - = re.sub(, new, text, count=0) # Substitutes all occurrences of the pattern. - = re.findall(, text) # Returns all occurrences of the pattern. + = re.sub(, new, text, count=0) # Substitutes all occurrences with 'new'. + = re.findall(, text) # Returns all occurrences as strings. = re.split(, text, maxsplit=0) # Use brackets in regex to keep the matches. = re.search(, text) # Searches for first occurrence of the pattern. = re.match(, text) # Searches only at the beginning of the text. diff --git a/index.html b/index.html index f3f97f8..cd7f92e 100644 --- a/index.html +++ b/index.html @@ -457,8 +457,8 @@ to_exclusive = <range>.stop
  • Also: 'isspace()' checks for '[ \t\n\r…]'.
  • #Regex

    import re
    -<str>   = re.sub(<regex>, new, text, count=0)  # Substitutes all occurrences of the pattern.
    -<list>  = re.findall(<regex>, text)            # Returns all occurrences of the pattern.
    +<str>   = re.sub(<regex>, new, text, count=0)  # Substitutes all occurrences with 'new'.
    +<list>  = re.findall(<regex>, text)            # Returns all occurrences as strings.
     <list>  = re.split(<regex>, text, maxsplit=0)  # Use brackets in regex to keep the matches.
     <Match> = re.search(<regex>, text)             # Searches for first occurrence of the pattern.
     <Match> = re.match(<regex>, text)              # Searches only at the beginning of the text.