Extract Variable with colon

I have the following endpoint:

api/proejcts/{uuid}:action

I want to extract the uuid variable.
I tried:

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}</Pattern>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
</URIPath>

But the variable is extracted with the :action suffix:

8345d473-a38f-4e1d-ac24-531e48637ca1:action

Is it possible to extract only the uuid?
thanks

1 Like

Ok, I found the answer.
I just need to flip the patterns:

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
        <Pattern ignoreCase="true">/projects/{uuid}</Pattern>
</URIPath>
1 Like

only this would work as well.

<URIPath>
        <Pattern ignoreCase="true">/projects/{uuid}:action</Pattern>
</URIPath>
1 Like

You’re correct, but I need the other pattern as well. thanks

YES. And why ? The patterns are checked in the order in which they appear in the policy configuration. When the first pattern matches, the policy does the extraction and then does not evaluate further patterns.

I’ll just add that according to the docs it tests for all patterns and the longest wins.

Thank you! For pointing that out. Let me follow-up to confirm that I am not mistaken. Either I am mistaken or the documentation is misleading. Either way, we’ll get it fixed.

From my testing, the docs are correct

Hi!!

You can use string manipulation

Ex String.Split(“:”) you can use this function
Best Paintball Gun Hopper2020