https://linen.dev logo
#help
Title
# help
d

Darren Rose

07/31/2023, 9:47 AM
Hi I am trying to match a url following (https://wiremock.org/docs/request-matching/) and am using
"url": "/1/indexes/*/queries(.*)",
but this regex does not match anything for example the following does not match
/1/indexes/*/queries?x-algolia-agent=Algolia%20for%20Java
- any help welcomed
ah `*`urlPathPattern``*
hmm I still observe
Copy code
-----------------------------------------------------------------------------------------------------------------------
| Closest stub                                             | Request                                                  |
-----------------------------------------------------------------------------------------------------------------------
                                                           |
POST                                                       | POST
[path regex] /1/indexes/*/queries(.*)                      | /1/indexes/*/queries?x-algolia-agent=Algolia%20for%20Java<<<<< URL does not match
                                                           | Script%20(4.13.1)%3B%20Node.js%20(18.16.1)%3B%20instantse
                                                           | arch.js%20(4.56.0)%3B%20react%20(17.0.2)%3B%20react-insta
                                                           | ntsearch%20(6.38.1)%3B%20react-instantsearch-hooks%20(6.3
                                                           | 8.1)%3B%20react-instantsearch-server%20(6.38.1)%3B%20JS%2
                                                           | 0Helper%20(3.13.3)
                                                           |
                                                           |
-----------------------------------------------------------------------------------------------------------------------
t

Tom

07/31/2023, 10:11 AM
Hi @Darren Rose,
*
on its own in a regex doesn’t do anything - you need
.*
or if you want to be more precise something like
[0-9a-z]*
Ah hang on - the
*
is actually a literal part of the URL in the request you’re sending? If that’s the case, you might need to escape it with a (I think double) backslash:
\\
👀 1
d

Darren Rose

07/31/2023, 11:04 AM
Hi @Tom the first * is a literal part of the request yes
I'll try
"urlPathPattern": "/1/indexes/\\*/queries(.*)",
yes that worked! thanks @Tom
👍 1