From 1d552e4c7619b64821f0e31e1f4b5fa00a0dd28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 20 Apr 2022 16:43:53 +0200 Subject: [PATCH] Regex, Exceptions --- README.md | 12 ++++++------ index.html | 16 ++++++++-------- parse.js | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f324893..73cb8a2 100644 --- a/README.md +++ b/README.md @@ -378,16 +378,16 @@ import re ``` ### Special Sequences -* **By default, decimal characters, alphanumerics and whitespaces from all alphabets are matched unless `'flags=re.ASCII'` argument is used.** -* **As shown below, it restricts special sequence matches to the first 128 characters and prevents `'\s'` from accepting `'[\x1c-\x1f]'` (the so-called separator characters).** -* **Use a capital letter for negation (all non-ASCII characters will be matched when used in combination with ASCII flag).** - ```python '\d' == '[0-9]' # Matches decimal characters. '\w' == '[a-zA-Z0-9_]' # Matches alphanumerics and underscore. '\s' == '[ \t\n\r\f\v]' # Matches whitespaces. ``` +* **By default, decimal characters, alphanumerics and whitespaces from all alphabets are matched unless `'flags=re.ASCII'` argument is used.** +* **As shown above, it restricts special sequence matches to the first 128 characters and prevents `'\s'` from accepting `'[\x1c-\x1f]'` (the so-called separator characters).** +* **Use a capital letter for negation (all non-ASCII characters will be matched when used in combination with ASCII flag).** + Format ------ @@ -1436,8 +1436,8 @@ BaseException +-- EOFError # Raised by input() when it hits end-of-file condition. +-- LookupError # Raised when a look-up on a collection fails. | +-- IndexError # Raised when a sequence index is out of range. - | +-- KeyError # Raised when a dictionary key or set element is not found. - +-- NameError # Raised when a variable name is not found. + | +-- KeyError # Raised when a dictionary key or set element is missing. + +-- NameError # Raised when an object is missing. +-- OSError # Errors such as “file not found” or “disk full” (see Open). | +-- FileNotFoundError # When a file or directory is requested but doesn't exist. +-- RuntimeError # Raised by errors that don't fall into other categories. diff --git a/index.html b/index.html index 4065966..26ffda6 100644 --- a/index.html +++ b/index.html @@ -355,16 +355,16 @@ to_exclusive = <range>.stop <int> = <Match>.end() # Returns exclusive end index of the match. -

Special Sequences

'\d' == '[0-9]'                                # Matches decimal characters.
+

Special Sequences

'\d' == '[0-9]'                                # Matches decimal characters.
 '\w' == '[a-zA-Z0-9_]'                         # Matches alphanumerics and underscore.
 '\s' == '[ \t\n\r\f\v]'                        # Matches whitespaces.
 
- +
    +
  • By default, decimal characters, alphanumerics and whitespaces from all alphabets are matched unless 'flags=re.ASCII' argument is used.
  • +
  • As shown above, it restricts special sequence matches to the first 128 characters and prevents '\s' from accepting '[\x1c-\x1f]' (the so-called separator characters).
  • +
  • Use a capital letter for negation (all non-ASCII characters will be matched when used in combination with ASCII flag).
  • +

#Format

<str> = f'{<el_1>}, {<el_2>}'
 <str> = '{}, {}'.format(<el_1>, <el_2>)
 
@@ -1232,8 +1232,8 @@ error_msg = ''.join(traceback.format_exception( ├── EOFError # Raised by input() when it hits end-of-file condition. ├── LookupError # Raised when a look-up on a collection fails. │ ├── IndexError # Raised when a sequence index is out of range. - │ └── KeyError # Raised when a dictionary key or set element is not found. - ├── NameError # Raised when a variable name is not found. + │ └── KeyError # Raised when a dictionary key or set element is missing. + ├── NameError # Raised when an object is missing. ├── OSError # Errors such as “file not found” or “disk full” (see Open). │ └── FileNotFoundError # When a file or directory is requested but doesn't exist. ├── RuntimeError # Raised by errors that don't fall into other categories. diff --git a/parse.js b/parse.js index 8eb91cb..f182b9e 100755 --- a/parse.js +++ b/parse.js @@ -234,8 +234,8 @@ const DIAGRAM_7_B = " ├── EOFError # Raised by input() when it hits end-of-file condition.\n" + " ├── LookupError # Raised when a look-up on a collection fails.\n" + " │ ├── IndexError # Raised when a sequence index is out of range.\n" + - " │ └── KeyError # Raised when a dictionary key or set element is not found.\n" + - " ├── NameError # Raised when a variable name is not found.\n" + + " │ └── KeyError # Raised when a dictionary key or set element is missing.\n" + + " ├── NameError # Raised when an object is missing.\n" + " ├── OSError # Errors such as “file not found” or “disk full” (see Open).\n" + " │ └── FileNotFoundError # When a file or directory is requested but doesn't exist.\n" + " ├── RuntimeError # Raised by errors that don't fall into other categories.\n" +