I have thousands of URLs to re-write. Therefore I tried to remove the .html extension and date(yyyy/mm/dd) from the URL. I can remove the extension. But I was unable to remove the date from the string.
Can anybody help me out?
I want remove date either this way 2020/11/05/ or this way /2020/11/05
How it looks: https://www.example.com/2020/11/05/my-post-slug-for-this-post-2022.htm
Expected Output: https://www.example.com/my-post-slug-for-this-post-2022
Thanks in advance
CodePudding user response:
You may try:
Formula in B1:
=REGEXREPLACE(A1,"(?:\/?\b\d{4}\/\d\d\/\d\d\b|\.html$)","")
I negated the format of 2020/11/05/ since I'm not sure you'd run into any issues using the above suggestion.
CodePudding user response:
try:
=INDEX(REGEXREPLACE(A1:A,"(?:\/\d{4}\/\d{2}\/\d{2}|\.html?$)", ))


