|| ||Ka-Ping Yee <python-XLawsxctnuM-AT-public.gmane.org> |
|| ||Guido van Rossum <guido-+ZN9ApsXKcEdnm+yROfE0A-AT-public.gmane.org> |
|| ||Re: New pattern-matching library (was: str.split
with multiple individual split characters) |
|| ||Mon, 28 Feb 2011 10:53:28 -0800 (PST)|
|| ||Article, Thread
On Mon, 28 Feb 2011, Guido van Rossum wrote:
> On Mon, Feb 28, 2011 at 8:04 AM, Mike Meyer <mwm-tkOQc4lHIczYtjvyW6yDsg@public.gmane.org> wrote:
>> Possibly we should investigate adding one of those to the standard
>> library, along with a cross-reference from the regexp documentation?
> It's been tried before without much success. I think it may have been
> a decade ago that Ka-Ping Yee created a pattern matching library that
> used function calls (and operator overloading? I can't recall) to
> generate patterns -- compiling to re patterns underneath. It didn't
> get much use.
Yes, there was operator overloading. The expressions looked like this:
letter + 3*digits + anyspace + either(some(digits), some(letters))
If anyone is curious, the module is available here:
You're welcome to experiment with it, modify it, use it as a starting
point for your own pattern matcher if you like.
to post comments)