Why is Postman giving the error “TypeError: e.exec is not a function”

Viewed 1031

I am trying to check if a string exists with

pm.expect(jsonData[0]["name"]).to.match('abagnale');

but I am getting

 TypeError: e.exec is not a function
1 Answers

Use a regex expression instead of a string

The error message is a little generic but in this case it can be fixed by using a regex

to.match(/abagnale/)

instead of a string

to.match('abagnale')
Related