I'm trying to validate URIs of the system with regex to identify parameters in the middle of the URI of a REST API, however, I'm having problems with parameter validation at the end of the URI, for example:
In the database I get the rule for URI: /uaa/api/users/*/city/*
Replace the '*' with the regex so that it accepts any character between / or after /: ^/uaa/api/users/+(.*)+/city/+(.*)$
I compare the URI with regex with the request URI: /uaa/api/users/john.connor/city/12
But if I remove the value at the end of the URI and leave only the / it accepts being that I need it to fail because there is no value after /, that is, when using the ^/uaa/api/users/+(.*)+/city/+(.*)$
regex with the /uaa/api/users/john.connor/city/
URI I need it to fail because there is no value after /.How can I do it so he does not accept a worthless bar followed in the end?
I do not know if that matters, but I'm using regex in Java!