I wrote a Regular Expression that generates a url like
/abc/deutschland/bbs-tagesfahrten/betz-mode-frotier-center-–-tress-teigwaren.html.
Now I want to replace the repeating dashes with the single on. How Can I?
I wrote a Regular Expression that generates a url like
/abc/deutschland/bbs-tagesfahrten/betz-mode-frotier-center-–-tress-teigwaren.html.
Now I want to replace the repeating dashes with the single on. How Can I?
To replace any repeated dashes in the whole URL:
<cfset InputUrl = "/abc/deutschland/bbs-tagesfahrten/betz-mode-frotier-center-–-tress-teigwaren.html">
<cfset CleanUrl = REReplace(InputUrl, "-+", "-", "ALL")>
To work on the file part only:
<cfset PathPart = REReplace(InputUrl, "(.*/).*", "\1")>
<cfset FilePart = ListLast(InputUrl, "/")>
<cfset CleanUrl = PathPart & REReplace(FilePart, "-+", "-", "ALL")>
Perhaps simpler that any of the suggestions would be:
s/-{2,}/-/g