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


Groups > comp.lang.python > #30421

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

Path csiph.com!usenet.pasdenom.info!news.albasani.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!ecngs!feeder2.ecngs.de!newsfeeder.ewetel.de!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ramit.prasad@jpmorgan.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'string.': 0.04; 'completeness': 0.07; 'interpreter.': 0.07; 'prefixed': 0.09; 'received:155': 0.09; 'although,': 0.16; 'disclaimers': 0.16; 'disclaimers,': 0.16; 'from:addr:jpmorgan.com': 0.16; 'received:155.180': 0.16; 'received:159.53': 0.16; 'received:exchad.jpmchase.net': 0.16; 'received:jpmchase.com': 0.16; 'received:jpmchase.net': 0.16; 'securities,': 0.16; 'subject:expression': 0.16; 'subject:regular': 0.16; 'subject:sign': 0.16; 'url:disclosures': 0.16; 'url:jpmorgan': 0.16; 'string': 0.17; 'wrote:': 0.17; '>>>': 0.18; 'to:name :python-list@python.org': 0.20; 'wednesday,': 0.22; 'received:169.254': 0.24; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; 'guess': 0.27; 'accuracy': 0.27; 'regular': 0.27; 'received:169': 0.29; 'starts': 0.29; 'header:Received:8': 0.30; 'anywhere': 0.33; 'to:addr:python-list': 0.33; 'subject:': 0.36; 'email addr:python.org': 0.36; 'method': 0.36; 'subject:with': 0.36; 'does': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'end': 0.40; 'think': 0.40; 'email name:python-list': 0.62; 'information,': 0.63; 'url:email': 0.63; 'legal': 0.65; '26,': 0.65; 'subject': 0.66; 'purchase': 0.67; 'dollar': 0.71; 'subjectcharset:utf-8': 0.72; 'sale': 0.76; 'received:169.254.8': 0.84; 'subject:dollar': 0.84
X-DKIM OpenDKIM Filter v2.1.3 sf2.jpmchase.com q8SI864D031784
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpmorgan.com; s=smtpout; t=1348855686; bh=wUvTCjqTXupn0q8AdYAFwGPRSVLD5C5yOZhqmit9p3s=; h=From:To:Subject:Date:Message-ID:References:In-Reply-To: Content-Transfer-Encoding:MIME-Version:Content-Type; b=qqnTYblpsgoRmfSTVhfVnXqm4ukUFV/G3pRLfBAh65XFq+c0+bM88JmsPgVHJXmVF W6mSP2N+SL1ZYfSCJmD2oWx0eS5VyVEfzEuqxAtMXfrX279zCG0t2WPoVzuaQey9hn 8fVrwrtJo51IuSf0wYjGOgQ+J50pWr1cecN6v4A8=
From "Prasad, Ramit" <ramit.prasad@jpmorgan.com>
To "python-list@python.org" <python-list@python.org>
Subject RE: regular expression : the dollar sign ($) work with re.match() or re.search() ?
Thread-Topic regular expression : the dollar sign ($) work with re.match() or re.search() ?
Thread-Index AQHNm7t0UhKYOWyDKki2Lgjuo3zxUZegD8XA
Date Fri, 28 Sep 2012 18:07:57 +0000
References <5d913584-b5ea-4ff1-8094-f4d5b273c0b6@googlegroups.com>
In-Reply-To <5d913584-b5ea-4ff1-8094-f4d5b273c0b6@googlegroups.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-originating-ip [10.67.79.47]
Content-Transfer-Encoding base64
MIME-Version 1.0
X-DLP-FWD Yes
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 <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.1576.1348855696.27098.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348855696 news.xs4all.nl 6915 [2001:888:2000:d::a6]:58958
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:30421

Show key headers only | View raw


iMath wrote:
> Sent: Wednesday, September 26, 2012 2:39 AM
> To: python-list@python.org
> Subject: regular expression : the dollar sign ($) work with re.match() or re.search() ?
> 
> I only know  the dollar sign ($) will match a pattern from the
> end of a string,but which method does it work with ,re.match() or re.search()  ?


You can try this on the interactive interpreter.
>>> re.match('hi$', 'xihi')
>>> re.search('hi$', 'xihi')
<_sre.SRE_Match object at 0x13FF7100>

Although, I think match does not work since match
only starts searching at the start of the string
while search looks for the pattern anywhere in the string.

>>> re.match('x.hi$', 'xihi')
<_sre.SRE_Match object at 0x15693BF0>

I guess you can consider re.match's pattern to be 
prefixed with '^'.

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

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