From 86ba74591d58c206d1ab2b38f5d001c42b01364b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Thu, 12 Dec 2019 22:11:36 +0100 Subject: [PATCH] Regex --- README.md | 6 +++--- index.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 56036eb..b02c1d3 100644 --- a/README.md +++ b/README.md @@ -351,10 +351,10 @@ Regex ----- ```python import re - = re.sub(, new, text, count=0) # Substitutes all occurrences. - = re.findall(, text) # Returns all occurrences. + = re.sub(, new, text, count=0) # Substitutes all occurrences of the pattern. + = re.findall(, text) # Returns all occurrences of the pattern. = re.split(, text, maxsplit=0) # Use brackets in regex to keep the matches. - = re.search(, text) # Searches for first occurrence of pattern. + = re.search(, text) # Searches for first occurrence of the pattern. = re.match(, text) # Searches only at the beginning of the text. = re.finditer(, text) # Returns all occurrences as match objects. ``` diff --git a/index.html b/index.html index 2e76762..f3f97f8 100644 --- a/index.html +++ b/index.html @@ -457,10 +457,10 @@ 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.
    -<list>  = re.findall(<regex>, text)            # Returns all occurrences.
    +<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.
     <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 pattern.
    +<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.
     <iter>  = re.finditer(<regex>, text)           # Returns all occurrences as match objects.