AssertionError When Matching URL Against Regex in Postman Te

Hi everyone,

I’m writing a test in Postman and encountering an AssertionError. I want to validate that my request URL follows the pattern /books/{id}, where {id} is a UUID.

Assertion Error:
[checkout a book] path is set to /books/:id | AssertionError: expected '{{baseUrl}}/books/{{id}}' to match /\/books\/:id$/


  • baseUrl:
  • id: 9d6dde43-8fdc-4b71-84b3-18507398d92f

Constructed URL:


The URL resolves correctly when I send the request, but my test assertion to match the URL pattern fails. I suspect my regex is incorrect for a UUID. Could someone help me adjust my regex to properly match a UUID in the URL?

How should I adjust my regex to correctly match the UUID format?

Thanks for your help!

Hey @eldor488 :wave:

Welcome to the Postman Community! :postman:

Could you provide more details about the regex that you’re using and the test script that you’re using here, please?

There are several topics on the forum around using regex to match a guid, here one that might help:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.