SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reverse regular expression...

    If there was an engine such that you would provide it data... tons of data, and it returns to you a regular expression for which all that data match, what would you use the regular expression for?

    Would such an engine resolve any problems? For instance, if you give it a list of email addresses, the engine will return a string representing the general regular expression for an email address.

    Dont mind *how* the engine works, im just wondering if anyone would use it?
    Thanken!,
    Omid Sadeghpour
    http://www.dailysite.com

  2. #2
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    982
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't see any use of it. There is no guarantee that the set of data I chose to have processed covers every possibility for the field.
    MySQL v5.1.58
    PHP v5.3.6

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yeah, it just makes an interesting question... the real question is, are there any examples where you dont need the regex to filter bad data out, but are there instances where once you have your data, that now you need its regex.

    Kinda like, after the chicken was already created from the egg, do you have any reason to analyze the chicken to redefine its egg ... haha, this is fun
    Thanken!,
    Omid Sadeghpour
    http://www.dailysite.com

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In fact, what you're asking is how to automatically generate a program that converts given input to given output. Although some efforts in this area has been made (see e.g. http://en.wikipedia.org/wiki/Genetic_programming), there is no universal working solution at this time, otherwise most of us would be forced to seek other ways to make a living.

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2007
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, we are still going to be making a living because regex will still be needed for the instances when the dataset does not exist. But this opens up the possibility of working backwards... perhaps add more demand
    Thanken!,
    Omid Sadeghpour
    http://www.dailysite.com

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I know what I'd call it, Xeger.

  7. #7
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    982
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it might be helpful. .htaccess regex comes to mind. If I had a list of file names that I need to write a rule for, if I could plug them in and come back with the most efficient and specific rule, it would be nice.
    MySQL v5.1.58
    PHP v5.3.6

  8. #8
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,098
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Xeger
    Thats just too funny ;-)

    I would call it
    PHP Code:
    kreskin($whatiwant$whatimightwant); 
    sorry, you started it!
    What I lack in acuracy I make up for in misteaks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •