How to use Regex in Gateway For Conditional Routing

Hello Everyone,
I Wan to use regex In conditional routing. Can anyone elaborate how we can do and what type expression we need that works in gateway


Lets say we have a scenario that, I have to check if the request url end with xyz, How can I check that with regular expression.

Url : https://host:port/internal/abc/xyz

Might ${request.payload.regex[.*/xyz$]} work? If my regex isn’t rusty:

.* – zero or more of any chars
/xyz – literal
$ – at end of string

This worked with this regex ${request.payload.regex[//xyz$/]}.
for my requirement i just has to check if the URL is ending with /xyz