I have a bunch of URLs counting to thousands i need to redirect and there are thre main patterns in URL
first pattern
There is a dash - starting the title url and want to remove that dash
e..g
www.example.com/buzz/news/the-written--malice-of-rdicile www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/5-kids--were-found-rigmaroling-armed www.example.com/break/news/5-kids-were-found-rigmaroling-armed
second pattern
There are two dashes -- in between urls that need to be changed to just one dash -
e..g
www.example.com/buzz/news/-the-written-malice-of-rdicile www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/-5-kids-were-found-rigmaroling-armed www.example.com/break/news/5-kids-were-found-rigmaroling-armed
third pattern
There is a dash - ending the title url and want to remove that dash
e..g
www.example.com/buzz/news/the-written-malice-of-rdicile- www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/5-kids-were-found-rigmaroling-armed- www.example.com/break/news/5-kids-were-found-rigmaroling-armed
fourth pattern There is combination of starting dash, double dashes and ending dash in the url and want to remove the starting dash and ending dash and change double dash to single dash e..g
www.example.com/buzz/news/-the-written--malice-of-rdicile- www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/-5-kids-were-found--rigmaroling-armed- www.example.com/break/news/5-kids-were-found-rigmaroling-armed
www.example.com/break/news/-5-kids-were-found-rigmaroling-armed- www.example.com/break/news/5-kids-were-found-rigmaroling-armed
There are about 5000 lines of these patterns, so looking for a way to use regex or other means to be able to run through all 5000ish lines and apply the apache rewrite to the URLs
Help will be VERY much appreciated. Thank you in advance
P.S will continue to edit to make question clearer; any question? please ask me.
So altogether, it looks like this LEFT will be the URL to be redirected and RIGHT will the the final URL users need to be on
www.example.com/buzz/news/the-written--malice-of-rdicile www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/5-kids--were-found-rigmaroling-armed www.example.com/break/news/5-kids-were-found-rigmaroling-armed
www.example.com/buzz/news/-the-written-malice-of-rdicile www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/-5-kids-were-found-rigmaroling-armed www.example.com/break/news/5-kids-were-found-rigmaroling-armed
www.example.com/buzz/news/-the-written--malice-of-rdicile- www.example.com/buzz/news/the-written-malice-of-rdicile
www.example.com/break/news/-5-kids-were-found--rigmaroling-armed- www.example.com/break/news/5-kids-were-found-rigmaroling-armed
www.example.com/break/news/-5-kids-were-found-rigmaroling-armed- www.example.com/break/news/5-kids-were-found-rigmaroling-armed