# 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.

![](/files/-M-ueTJkC1V22ACbKSeR)

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/profile`**&#x6F;&#x72;**`https://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.&#x20;

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

> You can also verify your text for regex validation here [***https://mocklets.com/regex***](https://mocklets.com/regex).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mocklets.com/managing-mock-apis/url-matching-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
