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


Groups > comp.lang.python > #38463

Re: Curious to see alternate approach on a search/replace via regex

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!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.107
X-Spam-Level *
X-Spam-Evidence '*H*': 0.79; '*S*': 0.00; 'referring': 0.07; 'thread,': 0.09; 'simple.': 0.16; 'subject:search': 0.16; 'wrote:': 0.17; 'feb': 0.19; 'earlier': 0.21; 'work,': 0.22; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'subject:/': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'worked': 0.30; 'fri,': 0.30; 'surely': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'characters': 0.36; 'depends': 0.36; 'being': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'six': 0.65; 'applying': 0.69; 'hand': 0.82; '2013': 0.84; 'subject:via': 0.84; 'sweeping': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=dM9dM9bpM7C/QrFT4JbwE1onKUkfo/gjQsC8VrfS4CI=; b=Km7QxYacDAtu5sHPvGNY/xj+Aeu3hBlTFXsP2fClaYWH55SNgq8tYuvjquxR2yxnwN gKr80vbpDQaM6kSqvjivvxShEyNPZKBI49r4Nc5z20Hl1F+96cVaUBd5kTLnxzWECs8f mEFwLH/mHgruE/RaLOgquZRH//kvQvRB7L/vcbeHe4gz3QnN5USvX3+FA7mx4cf9zuWv MOAz23z1XEpt1Eq7gJwjbaCPJ9RiwuWPDFVOs/S4WCBoC6jvNlFBpiiMkbQSUG5wCHlU Y8T+RRisTIaLa8CibzQrSSa19mmwj6DWYrYklBTqar5AaWd4GkfgFDgWsZ8tlhzqUPOT XhrQ==
X-Received by 10.66.52.50 with SMTP id q18mr18933982pao.16.1360340858594; Fri, 08 Feb 2013 08:27:38 -0800 (PST)
MIME-Version 1.0
In-Reply-To <5114e4c8$0$29975$c3e8da3$5496439d@news.astraweb.com>
References <mailman.1426.1360187770.2939.python-list@python.org> <511319c7$0$21812$c3e8da3$76491128@news.astraweb.com> <mailman.1437.1360207874.2939.python-list@python.org> <51142e96$0$6512$c3e8da3$5496439d@news.astraweb.com> <mailman.1460.1360278819.2939.python-list@python.org> <51143feb$0$29974$c3e8da3$5496439d@news.astraweb.com> <CALwzidmiR=ZaSF=woeHgOOmVtCrcngnFm_bMOizM+Lo6OOALBA@mail.gmail.com> <CALwzid=fkG9fFELE_xRmJwM2-KvhkBLkSw6_OBuUpZ+wshMbVA@mail.gmail.com> <20130207215755.3c4a5c464357313496320cc3@lavabit.com> <mailman.1492.1360311744.2939.python-list@python.org> <5114e4c8$0$29975$c3e8da3$5496439d@news.astraweb.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Fri, 8 Feb 2013 09:26:58 -0700
Subject Re: Curious to see alternate approach on a search/replace via regex
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.1513.1360341326.2939.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360341326 news.xs4all.nl 6965 [2001:888:2000:d::a6]:44488
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38463

Show key headers only | View raw


On Fri, Feb 8, 2013 at 4:43 AM, Steven D'Aprano
<steve+comp.lang.python@pearwood.info> wrote:
> Ian Kelly wrote:
> Surely that depends on the size of the pattern, and the size of the data
> being worked on.

Natually.

> Compiling the pattern "s[ai]t" doesn't take that much work, it's only six
> characters and very simple. Applying it to:
>
> "sazsid"*1000000 + "sat"
>
> on the other hand may be a tad expensive.
>
> Sweeping generalities about the cost of compiling regexes versus searching
> with them are risky.

I was referring to the specific timing measurements I made earlier in
this thread, not generalizing.

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


Thread

Re: Curious to see alternate approach on a search/replace via regex Demian Brecht <demianbrecht@gmail.com> - 2013-02-06 13:55 -0800
  Re: Curious to see alternate approach on a search/replace via regex Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-07 03:04 +0000
    Re: Curious to see alternate approach on a search/replace via regex rh <richard_hubbe11@lavabit.com> - 2013-02-06 19:31 -0800
      Re: Curious to see alternate approach on a search/replace via regex Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-08 09:45 +1100
        Re: Curious to see alternate approach on a search/replace via regex rh <richard_hubbe11@lavabit.com> - 2013-02-07 15:13 -0800
          Re: Curious to see alternate approach on a search/replace via regex Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-08 10:59 +1100
            Re: Curious to see alternate approach on a search/replace via regex Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-07 17:55 -0700
              Re: Curious to see alternate approach on a search/replace via regex Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-08 14:02 +1100
                Re: Curious to see alternate approach on a search/replace via regex rh <richard_hubbe11@lavabit.com> - 2013-02-07 21:35 -0800
            Re: Curious to see alternate approach on a search/replace via regex Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-07 18:08 -0700
            Re: Curious to see alternate approach on a search/replace via regex rh <richard_hubbe11@lavabit.com> - 2013-02-07 21:57 -0800
            Re: Curious to see alternate approach on a search/replace via regex Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-08 01:21 -0700
              Re: Curious to see alternate approach on a search/replace via regex Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-08 22:43 +1100
                Re: Curious to see alternate approach on a search/replace via regex Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-08 09:26 -0700
            Re: Curious to see alternate approach on a search/replace via regex Serhiy Storchaka <storchaka@gmail.com> - 2013-02-15 22:58 +0200
            Re: Curious to see alternate approach on a search/replace via regex rh <richard_hubbe11@lavabit.com> - 2013-02-26 11:20 -0800
        Re: Curious to see alternate approach on a search/replace via regex Dave Angel <davea@davea.name> - 2013-02-08 01:27 -0500
    Re: Curious to see alternate approach on a search/replace via regex jmfauth <wxjmfauth@gmail.com> - 2013-02-07 03:08 -0800
      Re: Curious to see alternate approach on a search/replace via regex Chris Angelico <rosuav@gmail.com> - 2013-02-07 23:44 +1100

csiph-web