Hi,

working with the 're' module I am having some difficulty figuring out simple RE. here is the code.


p = re.complie('amb')
m = p.match("mamba")
print m.group()

according to the following documents ...

http://www.amk.ca/python/howto/regex/regex.html#SECTION000300000000000000000
http://gnosis.cx/publish/programming/regular_expressions.html

there should be a pattern match like... 'amb' but I am getting 'None' back.

Can someone help explain the reason?

Thanks greatly for any help

-- Andrew

Tried using p.search

worked.

SOLVED

--Andrew

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.