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


Groups > comp.lang.python > #76338

Re: PyMatch Tool.

References <198ac789-f8e3-4f81-b10f-d7b29c25a70f@googlegroups.com> <CAPTjJmqhZE7M88cENbNqT+f94heEoLM1nivQoKRb0vAz3QAbig@mail.gmail.com>
Date 2014-08-14 19:31 -0500
Subject Re: PyMatch Tool.
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.13014.1408062666.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Aug 14, 2014 at 5:49 PM, Chris Angelico <rosuav@gmail.com> wrote:
>
> > Tool -> https://github.com/rfunix/PyMatch
>
> How is this better than GNU sed?

I didn't look closely at the program, but I have an idea how I might use it.

Back in the dawn of Internet time (before Y2K, Django, V8, etc) I
developed and maintained a concert calendar website. It had a database
of tour dates, and a bunch of handwritten HTML. And, I allowed people
to describe their concert tour information in a
slightly-higher-than-regex level (SLTRL). This facility allowed me to
routinely process known tour date listings and update my listings with
little, if any, manual intervention.  Under the covers, of course, it
used regular expressions. I had, as they say, two problems.

My solution to failed matches (I was actually the heaviest user of the
system) was to provide a <textarea> where you could paste in some tour
dates as they appeared on an artist's website, then enter the SLTRL
notation you thought described the dates. Most of the time things were
pretty easy to handle, but every now and then it would fail. I would
then start lopping of chunks of the SLTRL from the right and see if
anything now matched, and if so, what was leftover.

This tool might work in a similar fashion. Run it repeatedly on the
same input with ever-more-complex patterns and groups until it matches
everything. Then you're done and you paste the ugly mess into your
code.

Then you have two problems. <wink>

Skip

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


Thread

PyMatch Tool. rafinha.unix@gmail.com - 2014-08-14 12:50 -0700
  Re: PyMatch Tool. Chris Angelico <rosuav@gmail.com> - 2014-08-15 08:49 +1000
  Re: PyMatch Tool. Skip Montanaro <skip@pobox.com> - 2014-08-14 19:31 -0500
  Re: PyMatch Tool. Christian Gollwitzer <auriocus@gmx.de> - 2014-08-15 22:59 +0200
    Re: PyMatch Tool. Rafael Francischini <rafinha.unix@gmail.com> - 2014-08-18 05:21 -0700
      Re: PyMatch Tool. Christian Gollwitzer <auriocus@gmx.de> - 2014-08-18 19:38 +0200
        Re: PyMatch Tool. Rafael Francischini <rafinha.unix@gmail.com> - 2014-08-18 13:14 -0700

csiph-web