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

Re: Change main category names

Quote Reply
Re: Change main category names In reply to
You need to execute an SQL query such that:

Code:
update Category
Set Name = replace (Name, 'old_string', 'new_string')
where Name RLIKE '^old_string'
This only works if the string you are replacing is unique (since there is no way to anchor the replacement).

So, you'd replace something like

Cars
Cars/VW
Cars/BMW

with 'Car' by using

Code:
update Category
Set Name = replace (Name, 'Cars', 'Car')
where Name RLIKE '^Car'
This would _not_ work on a title like:

Cars/Electric Cars

Since that would get replaced with:

Car/Electric Car


I've only replaced sub and sub-sub cagegories, so I was replacing a string like:

Level1/Level2/Level3

With

Level1a/Level2a/Level3a

And the odds of hitting that sort of reproducing pattern were small.

I don't see a regex based replacement within the SQL language, but maybe someone else knows of one.

http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Subject Author Views Date
Thread Change main category names Martin Kjeldsen 3530 Sep 20, 2000, 6:12 AM
Post Re: Change main category names
Alex404 3438 Sep 20, 2000, 6:26 AM
Thread Re: Change main category names
pugdog 3445 Sep 20, 2000, 6:42 AM
Post Re: Change main category names
Alex404 3435 Sep 20, 2000, 6:57 AM