Generating a URL pattern when provided a set of 5 or so URLs
Posted
by ryan
on Stack Overflow
See other posts from Stack Overflow
or by ryan
Published on 2010-03-02T10:06:23Z
Indexed on
2010/06/07
11:32 UTC
Read the original article
Hit count: 299
Provided with a set of URLs, I need to generate a pattern,
For example:
http://www.buy.com/prod/disney-s-star-struck/q/loc/109/213724402.html
http://www.buy.com/prod/samsung-f2380-23-widescreen-1080p-lcd-monitor-150-000-1-dc-8ms-1920-x/q/loc/101/211249863.html
http://www.buy.com/prod/panasonic-nnh765wf-microwave-oven-countertop-1-6-ft-1250w-panasonic/q/loc/66357/202045865.html
http://www.buy.com/prod/escape-by-calvin-klein-for-women-3-4-oz-edp-spray/q/loc/66740/211210860.html
http://www.buy.com/prod/v-touch-8gb-mp3-mp4-2-8-touch-screen-2mp-camera-expandable-minisd-w/q/loc/111/211402014.html
Pattern is
http://www.buy.com/prod/[^~]/q/loc/[^~].html
© Stack Overflow or respective owner