This can be accomplished using an Nginx rewrite rule. These use regular expressions to match different parts of the URL and then "rewite" them.
There will be differences based on whether
xxxx is alaways
xxxx or if you also want
yyyy to match, but here is a minimal working example as a reference point:
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
index index.html index.htm;
rewrite (xxxx/.*)-\d+(.*)$ /$1$2 last;
Breaking down the regex a bit:
(xxxx/.*) captures every thing highlighted in red:
-\d+ matches on:
(.*)$ captures every thing that follows:
/$1$2 takes the first captured part (
$1) and appends the second (
$2), leaving you with:
regex101.com is a great tool for testing and explaining how different regular expressions work.
Check out this one, and modify it as needed for your real use case:
As system administrators, developers, QA engineers, support engineers, etc. one needs to find a particular pattern, like a set of IP addresses belonging to certain range or a range of time-stamps or groups of domain or subdomain names, from files. One might also need to find a word spelled in a particular way or find possible typos in a file. This is where regular expressions come in. Regular expressions are templates to match patterns (or sometimes not to match patterns). They provide a way to describe and parse text. This tutorial will give an insight to regular expressions without going into particularities of any language. We will simply use egrep to explain the concepts.