The goal is to clean up a character string and delete elements not important for the user and SEO ie the (letter before the apostrophes) in my case. I would mainly like a solution or an explanation of a regex that would do that in PHP but the logic is no different in JS.
character string : …/mode-d’emploi/…
Become:
url: /mode-emploi/slug-34
Maybe someone can help me.
2
Answers
You can split with the apostrophe and then remove the last character of the first splitted string so that it simulates the removal of character just before apostrophe:
This removes any character before an apostrophe and the apostrophe.
If you want to remove a letter only, use: