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


Groups > comp.lang.python > #30424

Re: regular expression : the dollar sign ($) work with re.match() or re.search() ?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'mode:': 0.07; 'prefixed': 0.09; 'sep': 0.09; 'subject:expression': 0.16; 'subject:regular': 0.16; 'subject:sign': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'equivalent': 0.20; 'header:In-Reply-To:1': 0.25; 'guess': 0.27; 'message-id:@mail.gmail.com': 0.27; 'case,': 0.29; 'fri,': 0.30; 'received:209.85.215.46': 0.30; 'subject: : ': 0.30; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'subjectcharset:utf-8': 0.72; 'subject:dollar': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=qHKvu/LKtRos24/NSW2M8dT+JjFCalm6zACru8RNVR8=; b=e9XreWchJzTEYgIc0pc7seDldSr839ChWwmPl1thOAb1W5y8MTENY86Jrz2kSM9+fD AHqM2Hf6A2L424BFqiwDV3Yum2R9ZxkPPeIhFVzz7wKEUfR5BF0vEodFKW4Xn04QFc5Z lLBSacfem+h5+T2RN5QYEXoAiGNlva+kixPdLeJrvVRVZUXmfg9MIcE1sbHGxLqYWeu7 +EOWjR1jK5VQ9ZlBd/r6Pzp9s5WSPq5ivwBbIV/x1z9JpFFGzG/r1hwasEQGngk3IJP/ avs8LNHrkDYjoQ9ut07WCRouzDmVHTl25s8XvORBUsfagyIxrjYYFf2n6M9IoZmdsL1A /xLg==
MIME-Version 1.0
In-Reply-To <5B80DD153D7D744689F57F4FB69AF474166CCB8B@SCACMX008.exchad.jpmchase.net>
References <5d913584-b5ea-4ff1-8094-f4d5b273c0b6@googlegroups.com> <5B80DD153D7D744689F57F4FB69AF474166CCB8B@SCACMX008.exchad.jpmchase.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 28 Sep 2012 12:32:07 -0600
Subject Re: regular expression : the dollar sign ($) work with re.match() or re.search() ?
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1579.1348857160.27098.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348857160 news.xs4all.nl 6983 [2001:888:2000:d::a6]:44604
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30424

Show key headers only | View raw


On Fri, Sep 28, 2012 at 12:07 PM, Prasad, Ramit
<ramit.prasad@jpmorgan.com> wrote:
> I guess you can consider re.match's pattern to be
> prefixed with '^'.

You can in this case, but they're not equivalent in multi-line mode:

>>> re.match('^two', 'one\ntwo', re.M)
>>> re.search('^two', 'one\ntwo', re.M)
<_sre.SRE_Match object at 0x0475BFA8>

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


Thread

regular expression :  the dollar sign ($) work with re.match() or re.search()  ? iMath <redstone-cold@163.com> - 2012-09-26 00:38 -0700
  Re: regular expression :  the dollar sign ($) work with re.match() or re.search() Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-09-26 10:48 +0300
    Re: regular expression : the dollar sign ($) work with re.match() or re.search() Chris Angelico <rosuav@gmail.com> - 2012-09-26 17:57 +1000
    Re: regular expression :  the dollar sign ($) work with re.match() or re.search() Alister <alister.ware@ntlworld.com> - 2012-09-26 15:47 +0000
      Re: regular expression :  the dollar sign ($) work with re.match() or re.search() Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-09-26 19:29 +0300
  Re: regular expression : the dollar sign ($) work with re.match() or re.search() ? Peter Otten <__peter__@web.de> - 2012-09-26 10:33 +0200
  RE: regular expression :  the dollar sign ($) work with re.match() or re.search()  ? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-09-28 18:07 +0000
  Re: regular expression : the dollar sign ($) work with re.match() or re.search() ? Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-28 12:32 -0600
  Re: regular expression :  the dollar sign ($) work with re.match() or re.search()  ? iMath <redstone-cold@163.com> - 2013-01-07 01:45 -0800
    Re: regular expression :  the dollar sign ($) work with re.match() or re.search()  � Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-07 09:54 +0000

csiph-web