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: 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; '>>>': 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 To: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --001a1133b3d438617e0509aedfe1 Content-Type: text/plain; charset=UTF-8 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 --001a1133b3d438617e0509aedfe1 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Folks ,

This =C2=A0might seem to be = very trivial question but iam breaking my head over it for a while .
<= div>
=C2=A0My understanding is that re.search should search f= or the match anywhere in the string .


why is re.search failing in the below case =C2=A0??

>>> pattern
'Token-based migrations ca= nnot be mixed with level-based: [prev 0 , now 1]'
>>>= ; text
' LogMessage {type NDMP_LOG_DBG} {msg_id 0} {msg The p= rocess id for NDMP service is 0x9c216370} {associated_msg 0} {associated_ms= g_seq 0} Source filer:DartOS =C2=A0Error: Token-based migrations cannot be = mixed with level-based: [prev 0 , now 1]'

>>> if (re.search(pattern,text)):
... =C2=A0 =C2= =A0print "Hi"
... else:
... =C2=A0 =C2=A0 pri= nt "BYE"
...
BYE

Regards,
Ganesh
--001a1133b3d438617e0509aedfe1--