<html>
<head>
<meta content="text/html; charset=gbk" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 2012/02/09 09:44 AM, daedae11 wrote:
<blockquote cite="mid:2012020915442644600514@126.com" type="cite">
<title>Email Signature</title>
<meta content="text/html; charset=gbk" http-equiv="Content-Type">
<style>
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
DIV.FoxDiv20120209154220318942 {
        LINE-HEIGHT: 1.5; FONT-FAMILY: & COLOR: #000000; FONT-SIZE: 10.5pt; 24494: ; amp: ; 36719: ; 38597: ; 40657:
}
BODY {
        LINE-HEIGHT: 1.5; FONT-FAMILY: ΢ÈíÑźÚ; COLOR: #000080; FONT-SIZE: 10.5pt
}
</style>
<meta name="GENERATOR" content="MSHTML 9.00.8112.16440">
However, re.match("hello", "And they said hello" ) will also
return None. So "And they said hello" also won't be matched
by the regex pattern "hello".
<div> </div>
<div> </div>
<hr style="WIDTH: 210px; HEIGHT: 1px" align="left" size="1"
color="#b5c4df">
<div><span>daedae11</span></div>
<div> </div>
<div style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none;
PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm;
BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none;
PADDING-TOP: 3pt">
<div style="PADDING-BOTTOM: 8px; PADDING-LEFT: 8px;
PADDING-RIGHT: 8px; BACKGROUND: #efefef; COLOR: #000000;
FONT-SIZE: 12px; PADDING-TOP: 8px">
<div><b>From:</b> <a moz-do-not-send="true"
href="mailto:cwitts@compuscan.co.za">Christian Witts</a></div>
<div><b>Date:</b> 2012-02-09 15:16</div>
<div><b>To:</b> <a moz-do-not-send="true"
href="mailto:daedae11@126.com">daedae11</a></div>
<div><b>CC:</b> <a moz-do-not-send="true"
href="mailto:tutor@python.org">turor_python</a></div>
<div><b>Subject:</b> Re: [Tutor] What the difference between
the two RE?</div>
</div>
</div>
<div>
<div class="FoxDiv20120209154220318942">On 2012/02/09 08:15 AM,
daedae11 wrote:
<blockquote cite="mid:201202091415049115699@126.com"
type="cite">
<style>BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
<meta name="GENERATOR" content="MSHTML 9.00.8112.16440">
<div>import re</div>
<div>re.match("^hello", "hello")</div>
<div>re.match("hello", "hello")</div>
<div> </div>
<div>Please give a string that matches RE "^hello" but does
not match RE "hello", or matches RE "hello" but does not
match RE "^hello".</div>
<div> </div>
<hr style="WIDTH: 210px; HEIGHT: 1px" align="left" size="1"
color="#b5c4df">
<div><span>daedae11</span></div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Tutor maillist - <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
To unsubscribe or change subscription options:
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a></pre>
</blockquote>
The caret ^ means "At the beginning of the line" so 'And they
said hello' will not be matched by the regex pattern '^hello'.<br>
<br>
The docs are pretty good on the module<br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://docs.python.org/library/re.html">http://docs.python.org/library/re.html</a><br>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://docs.python.org/howto/regex.html">http://docs.python.org/howto/regex.html</a><br>
<div class="moz-signature">-- <br>
<style type="text/css">P {
        FONT-FAMILY: Arial, Helvetica, sans-serif; COLOR: #000; FONT-SIZE: 8.5pt
}
.subscribe {
        FONT-STYLE: italic; FONT-WEIGHT: bold
}
.compuscan {
        TEXT-TRANSFORM: uppercase; LETTER-SPACING: 2px; COLOR: #c60c30; FONT-WEIGHT: bold
}
.green {
        COLOR: #093
}
</style>
<p>Christian Witts<br>
Python Developer<br>
<em class="green"></em></p>
</div>
--</div>
</div>
</blockquote>
<font color="#000000">From the docs
<a class="moz-txt-link-freetext" href="http://docs.python.org/library/re.html#re.match">http://docs.python.org/library/re.html#re.match</a><br>
Note: If you want to locate a match anywhere in string, use
search() instead.</font><br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title>Email Signature</title>
<style type="text/css">
p { font-size:8.5pt; font-family: Arial, Helvetica, sans-serif; color: #000;}
.subscribe {font-weight:bold; font-style:italic;}
.compuscan {color: #c60c30; letter-spacing:2px; text-transform:uppercase; font-weight:bold}
.green {color:#093;}
</style>
<p>Christian Witts<br>
Python Developer<br>
<em class="green"></em></p>
</div>
</body>
</html>