• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inverse Regex Library?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inverse Regex Library?


  • Subject: Re: Inverse Regex Library?
  • From: "Vincent E." <email@hidden>
  • Date: Thu, 17 Jul 2008 18:18:18 +0200

It could also have been:
	Word[1247]?[1235789]
or
	Word[124578][13579]?

Conclusion:
Don't think a reliable solution for this can exist. It's just too few information to detect the right pattern.
Even as a human being I'm actually not even 75% sure what's the right pattern for these words. How should a computer then?


On Jul 17, 2008, at 5:18 PM, Erik Buck wrote:

You ask an interesting computer science question (that's unrelated to Cocoa).

Surely the following sequence of words would produce Word[1-9]{1,2} instead of Word[0-9]{1,2} because there is no representative 0 in the sample ?

 "Word1"
"Word2"
"Word5"
"Word8"
"Word11"
"Word19"
"Word23"
"Word45"
"Word77"

Anyway, I think this is an unsolvable problem, and I might start with an attempted proof of its unsolvability rather than a solution. Lots of artificial intelligence and/or statistical pattern recognition could be applied to achieve reasonable results in general cases. If you have specific cases like letters followed by numbers you might use a lexer and parser like flex/bison.

Have you considered a "perfect hash" ? What are you really trying to achieve ?
http://en.wikipedia.org/wiki/Perfect_hash_function
http://www.nist.gov/dads/HTML/minimalPerfectHash.html
_______________________________________________

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


References: 
 >Re: Inverse Regex Library? (From: Erik Buck <email@hidden>)

  • Prev by Date: Re: Where's the best place for addObserver and removeObserver
  • Next by Date: How to programmatically open an NSComboBox's list?
  • Previous by thread: Re: Inverse Regex Library?
  • Next by thread: Re: Inverse Regex Library?
  • Index(es):
    • Date
    • Thread