Skip to content

Commit e08ed0a

Browse files
committed
Regex
1 parent 86ba745 commit e08ed0a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,8 @@ Regex
351351
-----
352352
```python
353353
import re
354-
<str> = re.sub(<regex>, new, text, count=0) # Substitutes all occurrences of the pattern.
355-
<list> = re.findall(<regex>, text) # Returns all occurrences of the pattern.
354+
<str> = re.sub(<regex>, new, text, count=0) # Substitutes all occurrences with 'new'.
355+
<list> = re.findall(<regex>, text) # Returns all occurrences as strings.
356356
<list> = re.split(<regex>, text, maxsplit=0) # Use brackets in regex to keep the matches.
357357
<Match> = re.search(<regex>, text) # Searches for first occurrence of the pattern.
358358
<Match> = re.match(<regex>, text) # Searches only at the beginning of the text.

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@
457457
<li><strong>Also: <code class="python hljs"><span class="hljs-string">'isspace()'</span></code> checks for <code class="python hljs"><span class="hljs-string">'[ \t\n\r…]'</span></code>.</strong></li>
458458
</ul>
459459
<div><h2 id="regex"><a href="#regex" name="regex">#</a>Regex</h2><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> re
460-
&lt;str&gt; = re.sub(&lt;regex&gt;, new, text, count=<span class="hljs-number">0</span>) <span class="hljs-comment"># Substitutes all occurrences of the pattern.</span>
461-
&lt;list&gt; = re.findall(&lt;regex&gt;, text) <span class="hljs-comment"># Returns all occurrences of the pattern.</span>
460+
&lt;str&gt; = re.sub(&lt;regex&gt;, new, text, count=<span class="hljs-number">0</span>) <span class="hljs-comment"># Substitutes all occurrences with 'new'.</span>
461+
&lt;list&gt; = re.findall(&lt;regex&gt;, text) <span class="hljs-comment"># Returns all occurrences as strings.</span>
462462
&lt;list&gt; = re.split(&lt;regex&gt;, text, maxsplit=<span class="hljs-number">0</span>) <span class="hljs-comment"># Use brackets in regex to keep the matches.</span>
463463
&lt;Match&gt; = re.search(&lt;regex&gt;, text) <span class="hljs-comment"># Searches for first occurrence of the pattern.</span>
464464
&lt;Match&gt; = re.match(&lt;regex&gt;, text) <span class="hljs-comment"># Searches only at the beginning of the text.</span>

0 commit comments

Comments
 (0)