Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82109

Python re.search simple question

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ganesh1pal@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:Python': 0.06; 'error:': 0.07; 'failing': 0.07; 'string': 0.09; 'mixed': 0.09; 'subject:question': 0.10; 'bye': 0.16; 'subject:simple': 0.16; 'folks': 0.16; '>>>': 0.22; 'to:name :python-list@python.org': 0.22; 'print': 0.22; '&gt;&gt;&gt;': 0.24; 'question': 0.24; 'source': 0.25; 'message- id:@mail.gmail.com': 0.30; 'skip:( 20': 0.30; 'breaking': 0.31; 'trivial': 0.31; 'text': 0.33; 'anywhere': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'skip:n 10': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=LsqTlhHtfD6ncNEzbjF04NPpGh3gjOEh0xOPF1yx4n0=; b=rnZeXk4Lplhg1oujEcwVVOE5LAfRBbJcEeT05X/7vsabO22W26eFcmmSExvgAhOu1/ RXjdpS6cxXvm9EP0sbJ2nveg+Ii3DmPDe0ea3GCtuQCSJ6dqUiqhDvOwCioLujgEGd2J +0NLu+cps4xE2HR9SpByjVkiyPyP2RBkXyzAoxi7wEaUuuZNxHnqGBT4VaRM75TYvlR7 5MLSe0bbobpa28mR5lyz/Lk0AtXkEF7CQKhh5T9QBJxAWeMzBWvet9j4l/UVqqdkSFkk E7wufljfYssxMBBOY3scyslR84v+D6z6XJDrXofYsR0S6nh0t85FiMJ1e3YGhsQXaywZ f5Aw==
MIME-Version 1.0
X-Received by 10.112.42.114 with SMTP id n18mr14914593lbl.44.1418021557525; Sun, 07 Dec 2014 22:52:37 -0800 (PST)
Date Mon, 8 Dec 2014 12:22:37 +0530
Subject Python re.search simple question
From Ganesh Pal <ganesh1pal@gmail.com>
To "python-list@python.org" <python-list@python.org>
Content-Type multipart/alternative; boundary=001a1133b3d438617e0509aedfe1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16710.1418021565.18130.python-list@python.org> (permalink)
Lines 53
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418021565 news.xs4all.nl 2886 [2001:888:2000:d::a6]:43674
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82109

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Folks ,

This  might seem to be very trivial question but iam breaking my head over
it for a while .

 My understanding is that re.search should search for the match anywhere in
the string .


why is re.search failing in the below case  ??

>>> pattern
'Token-based migrations cannot be mixed with level-based: [prev 0 , now 1]'
>>> text
' LogMessage {type NDMP_LOG_DBG} {msg_id 0} {msg The process id for NDMP
service is 0x9c216370} {associated_msg 0} {associated_msg_seq 0} Source
filer:DartOS  Error: Token-based migrations cannot be mixed with
level-based: [prev 0 , now 1]'

>>> if (re.search(pattern,text)):
...    print "Hi"
... else:
...     print "BYE"
...
BYE

Regards,
Ganesh

Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Python re.search simple question Ganesh Pal <ganesh1pal@gmail.com> - 2014-12-08 12:22 +0530
  Re: Python re.search simple question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-08 09:08 +0200
    Re: Python re.search simple question Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-12-08 09:13 +0200
  Re: Python re.search simple question Denis McMahon <denismfmcmahon@gmail.com> - 2014-12-09 00:31 +0000

csiph-web