From 6290d96fd187b783ccf2b82d87c9d64df0e3c8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sat, 7 Sep 2019 19:20:50 +0200 Subject: [PATCH] Regex --- README.md | 16 ++++++++-------- index.html | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 6e7d5f2..c856e2d 100644 --- a/README.md +++ b/README.md @@ -364,20 +364,20 @@ import re ### Match Object ```python - = .group() # Whole match. Also group(0). - = .group(1) # Part in first bracket. - = .groups() # All bracketed parts. - = .start() # Start index of a match. - = .end() # Exclusive end index of a match. + = .group() # Whole match. Also group(0). + = .group(1) # Part in first bracket. + = .groups() # All bracketed parts. + = .start() # Start index of a match. + = .end() # Exclusive end index of a match. ``` ### Special Sequences * **By default digits, whitespaces and alphanumerics from all alphabets are matched, unless `'flags=re.ASCII'` argument is used.** * **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 ``` diff --git a/index.html b/index.html index 30ed206..f72e588 100644 --- a/index.html +++ b/index.html @@ -467,19 +467,19 @@ to_exclusive = <range>.stop
  • Use r'\1' or '\\1' for backreference.
  • Add '?' after an operator to make it non-greedy.
  • -

    Match Object

    <str>   = <Match>.group()   # Whole match. Also group(0).
    -<str>   = <Match>.group(1)  # Part in first bracket.
    -<tuple> = <Match>.groups()  # All bracketed parts.
    -<int>   = <Match>.start()   # Start index of a match.
    -<int>   = <Match>.end()     # Exclusive end index of a match.
    +

    Match Object

    <str>   = <Match>.group()                      # Whole match. Also group(0).
    +<str>   = <Match>.group(1)                     # Part in first bracket.
    +<tuple> = <Match>.groups()                     # All bracketed parts.
    +<int>   = <Match>.start()                      # Start index of a match.
    +<int>   = <Match>.end()                        # Exclusive end index of a match.
     

    Special Sequences

    • By default digits, whitespaces and alphanumerics from all alphabets are matched, unless 'flags=re.ASCII' argument is used.
    • Use capital letters for negation.
    • -
    '\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