I need to support endpoints such as
/myendpoint:
/v1/myendpoint:
/v3/someotherendpoint:
This regex:
const regexPattern = '/[a-zA-Z0-9-]+:';
Only answers to /myendpoint:
How can we do an or operation to support both cases ?
>Solution :
Just make it something like recursive your existing solution for its multiple instance.
Example: (\/[a-zA-Z0-9-]+)*:
Play: https://regexr.com/6jka3
The character * in a regular expression means "match the preceding character zero or many times"