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

References (6 earlier) <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 2013-02-08 09:26 -0700
Subject Re: Curious to see alternate approach on a search/replace via regex
Newsgroups comp.lang.python
Message-ID <mailman.1513.1360341326.2939.python-list@python.org> (permalink)

Show all headers | 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