0

Hi all, I just had a simple regular expression question. Why does this only match the first character in the string? it should find the 'a' no matter where it is in the string, right?

C:\Python26>python.exe
Python 2.6.2 (r262:71605, Apr 14 2009, 22:46:50) [MSC v.1500 64 bit (AMD64)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> print re.match ('a', 'dda')
None
>>> print re.match ('a', 'add')
<_sre.SRE_Match object at 0x0000000001D11370>
>>>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dissident85
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.