* **Argument `'flags=re.IGNORECASE'` can be used with all functions.**
* **Argument `'flags=re.MULTILINE'` makes `'^'` and `'$'` match the start/end of each line.**
* **Argument `'flags=re.DOTALL'` makes dot also accept the `'\n'`.**
* **Use `r'\1'` or `'\\1'` for backreference.**
* **Add `'?'` after an operator to make it non-greedy.**
* **Use `r'\1'` or `'\\1'` for backreference (`'\1'` returns a character with octal code 1).**
* **Add `'?'` after `'*'` and `'+'` to make them non-greedy.**
### Match Object
```python
@ -380,7 +380,7 @@ 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.**
* **Use a capital letter for negation (all non-ASCII characters will be matched when used in combination with ASCII flag).**
* **When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. That makes `'{6.5:.0f}'` a `'6'` and `'{7.5:.0f}'` an `'8'`.**
* **This rule only works for numbers that can be represented exactly by a float (`.5`, `.25`, …).**
<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>Argument <codeclass="python hljs"><spanclass="hljs-string">'flags=re.DOTALL'</span></code> makes dot also accept the <codeclass="python hljs"><spanclass="hljs-string">'\n'</span></code>.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">r'\1'</span></code> or <codeclass="python hljs"><spanclass="hljs-string">'\\1'</span></code> for backreference.</strong></li>
<li><strong>Add <codeclass="python hljs"><spanclass="hljs-string">'?'</span></code> after an operator to make it non-greedy.</strong></li>
<li><strong>Use <codeclass="python hljs"><spanclass="hljs-string">r'\1'</span></code> or <codeclass="python hljs"><spanclass="hljs-string">'\\1'</span></code> for backreference (<codeclass="python hljs"><spanclass="hljs-string">'\1'</span></code> returns a character with octal code 1).</strong></li>
<li><strong>Add <codeclass="python hljs"><spanclass="hljs-string">'?'</span></code> after <codeclass="python hljs"><spanclass="hljs-string">'*'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'+'</span></code> to make them non-greedy.</strong></li>
</ul>
<div><h3id="matchobject">Match Object</h3><pre><codeclass="python language-python hljs"><str> = <Match>.group() <spanclass="hljs-comment"># Returns the whole match. Also group(0).</span>
<str> = <Match>.group(<spanclass="hljs-number">1</span>) <spanclass="hljs-comment"># Returns part in the first bracket.</span>
<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 below, 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>Use a capital letter for negation.</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>When both rounding up and rounding down are possible, the one that returns result with even last digit is chosen. That makes <codeclass="python hljs"><spanclass="hljs-string">'{6.5:.0f}'</span></code> a <codeclass="python hljs"><spanclass="hljs-string">'6'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'{7.5:.0f}'</span></code> an <codeclass="python hljs"><spanclass="hljs-string">'8'</span></code>.</strong></li>
<li><strong>This rule only works for numbers that can be represented exactly by a float (<codeclass="python hljs"><spanclass="hljs-number">.5</span></code>, <codeclass="python hljs"><spanclass="hljs-number">.25</span></code>, …).</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'int(<str>)'</span></code> and <codeclass="python hljs"><spanclass="hljs-string">'float(<str>)'</span></code> raise ValueError on malformed strings.</strong></li>
<li><strong>Decimal numbers can be represented exactly, unlike floats where <codeclass="python hljs"><spanclass="hljs-string">'1.1 + 2.2 != 3.3'</span></code>.</strong></li>
<li><strong>All decimal numbers are stored exactly, unlike floats where <codeclass="python hljs"><spanclass="hljs-string">'1.1 + 2.2 != 3.3'</span></code>.</strong></li>
<li><strong>Precision of decimal operations is set with: <codeclass="python hljs"><spanclass="hljs-string">'decimal.getcontext().prec = <int>'</span></code>.</strong></li>