By using a regex match.
Postman uses JavaScript under the hood, so this is easily searchable on the web.
javascript - How to test valid UUID/GUID? - Stack Overflow
Which will give you something like the following. I’ve put it in a loop, and I’m getting a random guid using Postman dynamic variables. They have the same format as UUID, but please read the first link for more info on this.
for (let i = 0; i < 10; i++) {
let uuid = pm.variables.replaceIn('{{$guid}}');
pm.test(`${uuid} is a valid UUID`, () => {
console.log(uuid);
pm.expect(uuid).to.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$/i);
});
}
As always, please remember to make the test fail to ensure its not giving a false positive.