[Tutor] What the difference between the two RE?

Brett Ritter swiftone at swiftone.org
Thu Feb 9 14:01:05 CET 2012


On Thu, Feb 9, 2012 at 1:15 AM, daedae11 <daedae11 at 126.com> wrote:
> import re
> re.match("^hello", "hello")
> re.match("hello", "hello")
>
> Please give a string that matches RE "^hello" but does not match RE "hello",
> or matches RE "hello" but does not match RE "^hello".

In addition to the other answers, it's important to note that nothing
in these REs require it to be a "word". So both of the above will
match the "hello" in "hellonwheels" for example.

-- 
Brett Ritter / SwiftOne
swiftone at swiftone.org


More information about the Tutor mailing list