[Tutor] Question regular expressions - the non-greedy pattern

2013-01-21 Thread Marcin Mleczko
Hello, in the howto (http://docs.python.org/2/howto/regex.html#regex-howto) there are code examples near the end of the page (the non-greedy pattern) I am referring to: s = 'Title' >>> len(s) 32 >>> print re.match('<.*>', s).span() (0, 32) >>> print re.match('<.*>', s).group() Title print re.ma

Re: [Tutor] Question regular expressions - the non-greedy pattern

2013-01-21 Thread Marcin Mleczko
and > from 2. resulting in '<' Am I right? If so, is there an easily graspable reason for the engine designers to implement it this way? If I'm wrong, where is my fault? Marcin Am 21.01.2013 17:23, schrieb Walter Prins: > Hi, > > > > On 21 January 2013 1

Re: [Tutor] Question regular expressions - the non-greedy pattern

2013-01-22 Thread Marcin Mleczko
-greedy > pattern > Message-ID: <50fdddc5.6030...@pearwood.info> > Content-Type: text/plain; charset=UTF-8; format=flowed > > On 22/01/13 10:11, Marcin Mleczko wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hello Hugo, hello Wa

[Tutor] Question on regular expressions

2013-02-12 Thread Marcin Mleczko
Hello, given this kind of string: "start SomeArbitraryAmountOfText start AnotherArbitraryAmountOfText end" a search string like: r"start.*?end" would give me the entire string from the first "start" to "end" : "start SomeArbitraryAmountOfText start AnotherArbitraryAmountOfText end" but I am int