You are here:  » Remove From Title & URL


Remove From Title & URL

Submitted by ItsDavid on Fri, 2018-04-20 13:25 in

Hi David,

Are there any current mods or a simple solution that could be used to strip\remove words from the titles and URL's similar to the stop words?

I would like to set a list of words to be stripped or removed from all titles and URL's

So if I don't want the following words in my titles and URL's I could add the following words to the list

Hi
Hello
Stop
Please

now this list of words would be removed from every product title and URL.

Best Regards,
David

Submitted by support on Fri, 2018-04-20 14:14

Hi David,

The Search and Replace RegExp filter from this comment will do the trick. After adding the filter, from /admin/ home click Global Filters and add a new Search and Replace RegExp filter to the Product Name field and in the text box on the configuration page for the filter, use for Search:

/(Hi|Hello|Stop|Please)/i

...and leave Replace empty.

The "/" characters in the Search value are the RegExp delimiters, and the regular expression itslef is a bracketed pipe separated list of strings to match. The "i" flag following the closing delimiter makes the expression case insensitive so "Hi" or "hi" etc. will all be replaced

Cheers,
David.
--
PriceTapestry.com

Submitted by ItsDavid on Fri, 2018-04-20 16:03

Hi David,

I noticed that when using such words as

/(in|with|and|please)/i

It removes those words anywhere even if they are in the middle of another word such as

the word "MATCHING" becomes "Matchg"

Is there a way to target the words as a single word?

Best Regards,
David

Submitted by support on Fri, 2018-04-20 16:38

Hi David,

My apologies I should have included this initially - you can use \b to match a word boundary (space, punctuation, beginning or end of line etc.). Have a go with:

/\b(in|with|and|please)\b/i

Here's a great RegExp crib sheet:

http://jkorpela.fi/perl/regexp.html

Cheers,
David.
--
PriceTapestry.com