# URL Matching Rules

The following describes the rules used for defining data matching conditions in page groups, conversions, and event settings.

#### Contains <a href="#bao-han" id="bao-han"></a>

Matches URLs that contain a specific string. For example, when "abc.com" is set as "Contains," URLs like the following will be included:

* `https://abc.com/lp`
* `https://abc.com/company`
* `https://abc.com/company/contact`

#### Does Not Contain <a href="#bu-bao-han" id="bu-bao-han"></a>

Matches URLs that do not contain a specific string. For example, if you want all pages except blog pages, you can set "example.com/blog" as "Does Not Contain."

#### Starts With <a href="#tou-pi-pei" id="tou-pi-pei"></a>

Matches URLs that start with the registered string. Typically used for URLs that contain query parameters.

For example, suppose a specific visitor (id=9982251615) visited the following URL:

`https://www.example.com/checkout.cgi?page=1&id=9982251615`

If the above URL is set as a "Starts With" match, only visits from the user with id=9982251615 will be affected, not visits from other users.

If you want to target all users but only on page=1, you can use the "Starts With" match with the following URL:

`https://www.example.com/checkout.cgi?page=1`

Additionally, if you want to include pages beyond just page=1, you can use the "Starts With" match with the following URL:

`https://www.example.com/checkout.cgi?page`

#### Ends With <a href="#wei-pi-pei" id="wei-pi-pei"></a>

Matches URLs that end with the registered string.

For example, if you register "/test/index.html" as an "Ends With" match, a URL like "<http://www.example.com/s/test/index.html>" would be included.

However, the following URL would not be matched because it does not end with "/test/index.html":

`http://www.example.com/s/test/index.html?wore=xxx`

#### Exact Match <a href="#wan-quan-pi-pei" id="wan-quan-pi-pei"></a>

Matches only when the configured URL is exactly the same as the actual URL.

* Tips: Match parameters: Uses page parameters as conditions, targeting only users with specific parameters. Ignore parameters: Targets all users visiting the page regardless of whether they carry parameters.

#### Regular Expression <a href="#zheng-ze-biao-da-shi" id="zheng-ze-biao-da-shi"></a>

Regular expressions are a method for representing multiple strings that follow a certain pattern.

By using regular expressions, you can define more flexible matching conditions.

**Common Regular Expression Examples**

1. Match a website domain at the beginning and end with a slash or question mark

**Regular expression**: `^https:\/\/www.ptmind.com($|\/$|\/\?.*)`

**Included URLs**: `https://www.ptmind.comhttps://www.ptmind.com/https://www.ptmind.com/?WT.mc_id=xxxx`

**Excluded URLs**: `https://www.ptmind.com/abc`

(Additional examples follow the same pattern)

#### Regular Expression Validation Tool <a href="#zheng-ze-biao-da-shi-yan-zheng-gong-ju" id="zheng-ze-biao-da-shi-yan-zheng-gong-ju"></a>

To verify that a regular expression is written correctly, you can use a tool such as the [Regex Tester](https://c.runoob.com/front-end/854/).

If you have any questions during setup, please feel free to contact us through the Ptengine support assistant.


---

# 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://helps.ptengine.com/en/faq/insight-setting/url-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.
