On Thu, Aug 14, 2014 at 5:49 PM, Chris Angelico <ros...@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 -- https://mail.python.org/mailman/listinfo/python-list