Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.06; 'failing': 0.07; 'string': 0.09; 'escape': 0.09; 'mixed': 0.09; 'subject:question': 0.10; 'literal.': 0.16; 'subject:simple': 0.16; 'folks': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'cc:addr:gmail.com': 0.22; 'to:name:python-list@python.org': 0.22; 'mon,': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'character': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'breaking': 0.31; 'trivial': 0.31; 'class': 0.32; 'anywhere': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'hope': 0.61; "you'll": 0.62; 'here': 0.66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=b+CgDfXDgjGd7ztIlUprsi8eaqaRfEBv7JllZy2i/y4=; b=wjd70runsiFUPv8eupLgrCArFEXE/cd9UhFlhuqQAo0zAN4TA9xUDNaA7Blxxn++Aa KX6FOrSKljjaih9BwXeeJLAvwhuD+eoVvyNzWsST2RsxpWlh8oFyjOGdsuOdvp9FPzoY RlCeWDE/1u4ZGoGsLkm6ZT5wiHpQykfE9KyBA5wz4R/9izoLAADMKfZgmZoWAMWB8K20 cyQDnqCmLoNwygBNjis6BvMggMjFoIVIvmt3e+U67iwzmrTpEjH7Nz3/xzfsY7yMpKGL rrF9JmCwjbLsniwGiyNblUIIDWCYmk1AsIeSYdBNLMuoVhJF90CHy9KqRK4jj7jZVVp9 pSfw== X-Received: by 10.202.196.206 with SMTP id u197mr5867784oif.21.1418022723893; Sun, 07 Dec 2014 23:12:03 -0800 (PST) MIME-Version: 1.0 Sender: zachary.ware@gmail.com In-Reply-To: References: From: Zachary Ware Date: Mon, 8 Dec 2014 01:11:43 -0600 X-Google-Sender-Auth: fmMA3_hbaXBJ62c1xbiRs_tXP0k Subject: Re: Python re.search simple question To: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418022726 news.xs4all.nl 2941 [2001:888:2000:d::a6]:51240 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82112 On Mon, Dec 8, 2014 at 12:52 AM, Ganesh Pal wrote: > 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]' Your pattern here contains a character class ([enoprvw 01,]). You'll need to escape the '[' character to make it literal. Hope this helps, -- Zach