I need to rewrite some blog URLs to remove certain characters. These are the along the lines of "a556" (a is always present, the numbers are always 3 digits and are random). This is proceeded by either a single or double hyphen, which I also need to remove.
These need to redirect from:
[domain]/blog/[article_name]-a556
or
[domain]/blog/[article_name]--a556
To
[domain]/blog/[article_name_with_characters_removed]
I think the regex to detect the text to be removed is:
([-]{1,2}a[0-9])\w+
But I don't know how to put this into a Rewrite rule.
Can anyone help?