in reply to Re^2: Reverse regexp a regexp?
in thread Reverse regexp a regexp?

Reread what Roboticus said. Your first example could just as easily have been http://www.youtube.com/user/test[1-5] and your second could have been http://(u[sk]|be)\.apple.itunes.com/blabla/blabla/id/(\d*)5(\d+).

How do you make the choices? Once you can answer those questions, you'll be able to make some progress towards what you want.

Replies are listed 'Best First'.
Re^4: Reverse regexp a regexp? (by an algorithm?)
by freakingwildchild (Scribe) on Feb 13, 2010 at 22:56 UTC
    How do you make the choices? Once you can answer those questions, you'll be able to make some progress towards what you want.

    I'd say ... an algorithm of minimum requirements could do the trick here.

    for example:

    1. 10 url's of the same domain of a 95% "similarity" would be matched as "clean url".
    2. 100 url's of the same domain would give more weight
    3. The string detected has to be atleast 4 characters difference before it adds weight/validity
    4. Any others could be selected manually or kept in a cache till they offer a difference
    Some url's will be easier than some others (especially script url's); but most sites got a general structure, to be SEO friendly towards search engines; which would make most URL's a heaven to work with...