Browse Source

Regex

pull/52/head
Jure Šorn 5 years ago
parent
commit
d1e8a838b9
2 changed files with 8 additions and 8 deletions
  1. 8
      README.md
  2. 8
      index.html

8
README.md

@ -368,11 +368,11 @@ import re
### Match Object
```python
<str> = <Match>.group() # Returns whole match. Also group(0).
<str> = <Match>.group(1) # Returns part in first bracket.
<str> = <Match>.group() # Returns the whole match. Also group(0).
<str> = <Match>.group(1) # Returns part in the first bracket.
<tuple> = <Match>.groups() # Returns all bracketed parts.
<int> = <Match>.start() # Returns start index of a match.
<int> = <Match>.end() # Returns exclusive end index of a match.
<int> = <Match>.start() # Returns start index of the match.
<int> = <Match>.end() # Returns exclusive end index of the match.
```
### Special Sequences

8
index.html

@ -473,11 +473,11 @@ to_exclusive = &lt;range&gt;.stop
<li><strong>Use <code class="python hljs"><span class="hljs-string">r'\1'</span></code> or <code class="python hljs"><span class="hljs-string">'\\1'</span></code> for backreference.</strong></li>
<li><strong>Add <code class="python hljs"><span class="hljs-string">'?'</span></code> after an operator to make it non-greedy.</strong></li>
</ul>
<div><h3 id="matchobject">Match Object</h3><pre><code class="python language-python hljs">&lt;str&gt; = &lt;Match&gt;.group() <span class="hljs-comment"># Returns whole match. Also group(0).</span>
&lt;str&gt; = &lt;Match&gt;.group(<span class="hljs-number">1</span>) <span class="hljs-comment"># Returns part in first bracket.</span>
<div><h3 id="matchobject">Match Object</h3><pre><code class="python language-python hljs">&lt;str&gt; = &lt;Match&gt;.group() <span class="hljs-comment"># Returns the whole match. Also group(0).</span>
&lt;str&gt; = &lt;Match&gt;.group(<span class="hljs-number">1</span>) <span class="hljs-comment"># Returns part in the first bracket.</span>
&lt;tuple&gt; = &lt;Match&gt;.groups() <span class="hljs-comment"># Returns all bracketed parts.</span>
&lt;int&gt; = &lt;Match&gt;.start() <span class="hljs-comment"># Returns start index of a match.</span>
&lt;int&gt; = &lt;Match&gt;.end() <span class="hljs-comment"># Returns exclusive end index of a match.</span>
&lt;int&gt; = &lt;Match&gt;.start() <span class="hljs-comment"># Returns start index of the match.</span>
&lt;int&gt; = &lt;Match&gt;.end() <span class="hljs-comment"># Returns exclusive end index of the match.</span>
</code></pre></div>
<div><h3 id="specialsequences">Special Sequences</h3><ul>

Loading…
Cancel
Save