<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Regular_Expressions</id>
	<title>Regular Expressions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Regular_Expressions"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Regular_Expressions&amp;action=history"/>
	<updated>2026-05-14T01:15:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Regular_Expressions&amp;diff=9200&amp;oldid=prev</id>
		<title>Kristian Rother at 20:02, 5 February 2013</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Regular_Expressions&amp;diff=9200&amp;oldid=prev"/>
		<updated>2013-02-05T20:02:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Cat|Python Commands}}&lt;br /&gt;
{{Python Links}}&lt;br /&gt;
&lt;br /&gt;
== More power for string operations ==&lt;br /&gt;
Regular expressions allow to perform string search &amp;amp; replace operations using patterns.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
import re&lt;br /&gt;
&lt;br /&gt;
text = &amp;#039;all ways lead to Rome&amp;#039;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Searching if something exists or not: =====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
re.search(&amp;#039;R...\s&amp;#039;, text)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Finding all words: =====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
re.findall(&amp;#039;\s(.o)&amp;#039;, text)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Replacing: =====&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
re.sub(&amp;#039;R[meo]+&amp;#039;,&amp;#039;London&amp;#039;, text)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to find the right pattern for your problem ==&lt;br /&gt;
Finding the right RegEx requires lots of trial-and-error search. You can test regular expressionsonline before including them into your program:&lt;br /&gt;
&lt;br /&gt;
http://www.regexplanet.com/simple/&lt;br /&gt;
&lt;br /&gt;
===== Characters used in RegEx patterns: =====&lt;br /&gt;
&lt;br /&gt;
Some of the most commonly used characters in Regular Expression patterns are:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
\d - decimal character [0..9]&lt;br /&gt;
&lt;br /&gt;
\w - alphanumeric [a..z] or [0..9]&lt;br /&gt;
&lt;br /&gt;
\A - start of the text&lt;br /&gt;
&lt;br /&gt;
\Z - end of the text&lt;br /&gt;
&lt;br /&gt;
[ABC] - one of characters A,B,C&lt;br /&gt;
&lt;br /&gt;
. - any character&lt;br /&gt;
&lt;br /&gt;
^A - not A&lt;br /&gt;
&lt;br /&gt;
a+ - one or more of pattern a&lt;br /&gt;
&lt;br /&gt;
a* - zero or more of pattern a&lt;br /&gt;
&lt;br /&gt;
a|b - either pattern a or b matches&lt;br /&gt;
&lt;br /&gt;
(a) - re.findall returns a&lt;br /&gt;
&lt;br /&gt;
\s - empty space&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Ignoring case == &lt;br /&gt;
If the case of the text should be ignored during the pattern matching, add , re.IGNORECASE to the parameters of any re function.&lt;/div&gt;</summary>
		<author><name>Kristian Rother</name></author>
	</entry>
</feed>