URL Regex Matching

Mocklets work on matching your API request URL, but in some cases exact matching on the request URL alone is not specific enough. For instance, you may want to simulate an API /api/user/<user_id>/profile, where some portion of the URL string is variable. We cannot expect one to create multiple APIs with all the possible matching URL. This is can be achieved by adding RegEx sequence in your API request URL.

To enable RegEx matching for your API, just replace the variable section of the URL with {...}. Mocklets system will auto detect the RegEx placeholder and validate it against the incoming request URL.

For example in the above screenshot, the mock API provided with path as https://api.mocklets.com/mock67795/user/{...}/profile is a valid candidate for requests like https://api.mocklets.com/mock67795/user/123456/profileorhttps://api.mocklets.com/mock67795/user/c81d4e2e-bcf2-11e6-869b-7df9253/profile.

If you want to add any regex element in the API path, use {...} in its place and later while making request to that API, replace {...} with actual text.

In order to be valid regex match, the actual text should only be comprised of the following. Alphabets a-z A-Z Numbers 0-9 Symbols _ - = + . @

You can also verify your text for regex validation here https://mocklets.com/regex.