Now I think I got it. Thanks a lot again.
Marcin
Am 22.01.2013 12:00, schrieb tutor-requ...@python.org:
>
> Message: 1
> Date: Tue, 22 Jan 2013 11:31:01 +1100
> From: Steven D'Aprano
> To: tutor@python.org
> Subject: Re: [Tutor] Question regular expressions - the non
Your understanding is flawed.
Try these actions and ponder their significance...
>>> s = '>> re.search('<.*?>',s).group()
'<'
>>> re.search('<.*>',s).group()
'>> s = '>> re.search('<.*>',s).group()
'<'
>>> re.search('<.*t',s).group()
'>> re.search('<
On 22/01/13 10:11, Marcin Mleczko wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Hugo, hello Walter,
first thank you very much for the quick reply.
The functions used here i.e. re.match() are taken directly form the
example in the mentioned HowTo. I'd rather use re.findall() but I
Hi Marcin,
On 21 January 2013 23:11, Marcin Mleczko wrote:
> first thank you very much for the quick reply.
>
No problem...
> The functions used here i.e. re.match() are taken directly form the
> example in the mentioned HowTo. I'd rather use re.findall() but I
> think the general interpretet
On 22/01/13 10:11, Marcin Mleczko wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Hugo, hello Walter,
first thank you very much for the quick reply.
The functions used here i.e. re.match() are taken directly form the
example in the mentioned HowTo. I'd rather use re.findall() but I
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello Hugo, hello Walter,
first thank you very much for the quick reply.
The functions used here i.e. re.match() are taken directly form the
example in the mentioned HowTo. I'd rather use re.findall() but I
think the general interpretetion of the giv
On 22/01/13 01:45, Marcin Mleczko wrote:
Now I'm changing the input string to (adding an extra '<'):
s = '', s).group()
I would expect to get the same result
as I'm using the non-greedy pattern. What I get is
<
Did I get th
Hi,
On 21 January 2013 14:45, Marcin Mleczko wrote:
> Did I get the concept of non-greedy wrong or is this really a bug?
Hugo's already explained the essence of your problem, but just to
add/reiterate:
a) match() will match at the beginning of the string (first character) or
not at all. As
On Mon, Jan 21, 2013 at 3:45 PM, Marcin Mleczko wrote:
> Now I'm changing the input string to (adding an extra '<'):
>
> s = '
> and evoking the last command again:
>
> print re.match('<.*?>', s).group()
> I would expect to get the same result
>
>
>
> as I'm using the non-greedy pattern.
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
10 matches
Mail list logo