Re: Inverse Regex Library?
Re: Inverse Regex Library?
- Subject: Re: Inverse Regex Library?
- From: "Andrew Thompson" <email@hidden>
- Date: Thu, 17 Jul 2008 09:30:36 -0700
Your question is a simple problem, actually, that hides a hard problem.
Creating a regex from a bunch of strings is simple, just take all the words
and OR them together, so in your example:
Word1 | Word2 | Word5 | Word8 | Word11 | Word19 | Word23 | Word45 | Word77
Unfortunately, there is no known reliable way to simplify a regular
expression (at least, not in 2002 when I took computer theory, if you find a
way, let me know). In addition, you are going to run into trouble.....how
will the computer know that it should convert the list into Word[0-9]{1,2}
instead of Word[1,2,5,8,4,7][1,9,3,5,7]?"
If I REALLY had to do this, I would consider using a neural network first.
It is a hard problem.
~Andrew
On Thu, Jul 17, 2008 at 7:09 AM, Philip Mötteli <email@hidden>
wrote:
> Hi,
>
>
> Does anybody know of a library, that takes a bunch of strings and produces
> a regex-string from them?
> E. g:
>
> "Word1"
> "Word2"
> "Word5"
> "Word8"
> "Word11"
> "Word19"
> "Word23"
> "Word45"
> "Word77"
>
> should give "Word[0-9]{1,2}". Or I would even be more happy with
> "Word[0-9]+".
> I've heard of Grail+. But are there any other options?
>
>
> Thanks
> P
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden