<list> = re.split(<regex>, text, maxsplit=0) # Use brackets in regex to include 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.
<iter> = re.finditer(<regex>, text) # Returns all occurrences as match objects.
<iter> = re.finditer(<regex>, text) # Returns all occurrences as Match objects.
```
* **Argument 'new' can be a function that accepts a match object and returns a string.**
* **Argument 'new' can be a function that accepts a Match object and returns a string.**
* **Search() and match() return None if they can't find a match.**
* **Argument `'flags=re.IGNORECASE'` can be used with all functions.**
* **Argument `'flags=re.MULTILINE'` makes `'^'` and `'$'` match the start/end of each line.**
@ -385,21 +385,21 @@ import re
```
* **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).**
* **As shown above, it restricts all 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
------
```python
<str> = f'{<el_1>}, {<el_2>}'
<str> = '{}, {}'.format(<el_1>, <el_2>)
<str> = f'{<el_1>}, {<el_2>}' # Curly braces also accept expressions.
<list> = re.split(<regex>, text, maxsplit=<spanclass="hljs-number">0</span>) <spanclass="hljs-comment"># Use brackets in regex to include the matches.</span>
<Match> = re.search(<regex>, text) <spanclass="hljs-comment"># Searches for first occurrence of the pattern.</span>
<Match> = re.match(<regex>, text) <spanclass="hljs-comment"># Searches only at the beginning of the text.</span>
<iter> = re.finditer(<regex>, text) <spanclass="hljs-comment"># Returns all occurrences as match objects.</span>
<iter> = re.finditer(<regex>, text) <spanclass="hljs-comment"># Returns all occurrences as Match objects.</span>
</code></pre></div>
<ul>
<li><strong>Argument 'new' can be a function that accepts a match object and returns a string.</strong></li>
<li><strong>Argument 'new' can be a function that accepts a Match object and returns a string.</strong></li>
<li><strong>Search() and match() return None if they can't find a match.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.IGNORECASE'</span></code> can be used with all functions.</strong></li>
<li><strong>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.MULTILINE'</span></code> makes <codeclass="python hljs"><spanclass="hljs-string">'^'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'$'</span></code> match the start/end of each line.</strong></li>
<li><strong>By default, decimal characters, alphanumerics and whitespaces from all alphabets are matched unless <codeclass="python hljs"><spanclass="hljs-string">'flags=re.ASCII'</span></code> argument is used.</strong></li>
<li><strong>As shown above, it restricts special sequence matches to the first 128 characters and prevents <codeclass="python hljs"><spanclass="hljs-string">'\s'</span></code> from accepting <codeclass="python hljs"><spanclass="hljs-string">'[\x1c-\x1f]'</span></code> (the so-called separator characters).</strong></li>
<li><strong>As shown above, it restricts all special sequence matches to the first 128 characters and prevents <codeclass="python hljs"><spanclass="hljs-string">'\s'</span></code> from accepting <codeclass="python hljs"><spanclass="hljs-string">'[\x1c-\x1f]'</span></code> (the so-called separator characters).</strong></li>
<li><strong>Use a capital letter for negation (all non-ASCII characters will be matched when used in combination with ASCII flag).</strong></li>
<li><strong>Options can be generated dynamically: <codeclass="python hljs"><spanclass="hljs-string">f'<spanclass="hljs-subst">{<el>:{<str/int>}</span>[…]}'</span></code>.</strong></li>
<li><strong>Adding <codeclass="python hljs"><spanclass="hljs-string">'!r'</span></code> before the colon converts object to string by calling its <ahref="#class">repr()</a> method.</strong></li>
<div><h4id="comparisonofpresentationtypes">Comparison of presentation types:</h4><pre><codeclass="text language-text">┏━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┓