Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Duplicate checking REGEX to add '/'

Quote Reply
Duplicate checking REGEX to add '/'
In my continuing exploration of SQL, to fix the database in the way I want it,
I figured I needed a quick and dirty fix for the URLs that ended in / and those
that didn't. The reason is duplicate checking -- I went from no dupes to 33
dupes on a 300 record database after using it.

Code:
SELECT URL FROM Links
WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'

Will find the links and display them that end in the most common domain endings.
You can add more to it just by following the example above. It won't catch the
url's that end with a directory name, but maybe I'll work on that.

To actually update the links, use:

Code:
UPDATE Links
SET URL = CONCAT(URL,'/')
WHERE LOWER(URL) RLIKE '.com$|.net$|.org$|.uk$|.au$'


You might want to try it on a test database first, using the INSERT query
I posted awhile back.


Subject Author Views Date
Thread Duplicate checking REGEX to add '/' pugdog 2256 Jan 13, 2000, 6:58 PM
Post Re: Duplicate checking REGEX to add '/'
pugdog 2183 Jan 14, 2000, 11:04 AM
Post Re: Duplicate checking REGEX to add '/'
carfac 2179 Jan 14, 2000, 8:06 PM
Post Re: Duplicate checking REGEX to add '/'
pugdog 2187 Jan 15, 2000, 4:30 AM
Post Re: Duplicate checking REGEX to add '/'
widgetz 2168 Jan 15, 2000, 12:44 PM
Post Re: Duplicate checking REGEX to add '/'
widgetz 2196 Jan 15, 2000, 12:51 PM
Post Re: Duplicate checking REGEX to add '/'
pugdog 2176 Jan 15, 2000, 1:48 PM
Post Re: Duplicate checking REGEX to add '/'
Alex 2179 Jan 17, 2000, 8:08 AM
Post Re: Duplicate checking REGEX to add '/'
pugdog 2182 Jan 17, 2000, 6:55 PM