I'd like to remove every special character from a string identifier and replace them with hyphens so it can be URL friendly.
This is part of Sitefinity CMS URL configuration, meaning that every time I create an item, it gets the title of it and generates a URL slug based on the regex expression I provide.
So I can only use ONE regex expression, and ONE substitution text, since it is added in Sitefinity's CMS URL configuration fields.
I can't use code or use regex in multiple steps.
So, for example, if I have the following title string:
Infographic phishing's awareness and $prevention (updated)
I'd like it to transform to:
infographic-phishing-awareness-and-prevention-updated
In Settings / Advanced / System / Site URL Settings / URLRulesClient we have the default regex expression set: [^\p{L}-!$()=@\d_'.]+|.+$
The problem is that when content is created, the URLs only replace spaces and not special characters, with hyphens.
Is there a way I can replace the last special characters at the end of the string with an empty space?
(^\w+)?(?:'s)?\W+(\w+)(?:\W+$)?
replace with$1-$2
– Spindlelegs(lorem) ipsum
. – Panelboard(?:^\W*(\w+))?(?:'s)?\W+(\w+)(?:\W+$)?
replace with$1-$2
? – Spindlelegsfoobar+
. – Panelboard