On Mon, 07 Jan 2013 01:45:58 -0800, iMath wrote:
> 在 2012年9月26日星期三UTC+8下午3时38分50秒,iMath写道:
>> 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() ?
>
> I thought re.match('h.$', 'hbxihi') will matc
在 2012年9月26日星期三UTC+8下午3时38分50秒,iMath写道:
> 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()
> ?
I thought re.match('h.$', 'hbxihi') will match ‘hi’ ,but it does not .so why ?
--
http://mail.python.or
On Fri, Sep 28, 2012 at 12:07 PM, Prasad, Ramit
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 obje
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 whic
Alister writes:
> On Wed, 26 Sep 2012 10:48:00 +0300, Jussi Piitulainen wrote:
>
> > iMath writes:
> >
> >> 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()
> >
> > It works with both. With re.m
On Wed, 26 Sep 2012 10:48:00 +0300, Jussi Piitulainen wrote:
> iMath writes:
>
>> 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()
>
> It works with both. With re.match, the pattern has to match at the
iMath wrote:
> 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() ?
Why not try it out in the interactive interpreter? Here's the "deluxe
version":
>>> def demo(pattern="mid$", texts=["start mid end",
On Wed, Sep 26, 2012 at 5:48 PM, Jussi Piitulainen
wrote:
> What was the weird character that you used as a question mark? I
> removed them because they confuse the newsreader I use.
It appears to be Unicode Character 'FULLWIDTH QUESTION MARK' (U+FF1F).
Normally I'd be inclined to simply use U+00
iMath writes:
> 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()
It works with both. With re.match, the pattern has to match at the
start of the string _and_ the $ has to match the end of the string (o
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() ?
--
http://mail.python.org/mailman/listinfo/python-list
10 matches
Mail list logo