# Matching Rule Details

## Matching Rule Details

In experience delivery conditions, page groups, conversions, and event settings, you define conditions for matching data using the rules below.

## Contains

Define URLs that contain a specific character string. For example, if you register "`abc.com`" as "contains," the following URLs are included in the target:

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

## Does Not Contain

Define URLs that do not contain a specific character string.

For example, if you want to target all pages except blog pages, register "`example.com/blog`" as "does not contain."

### **When there are multiple entries in the input field**

If any of the entries are included, they are excluded from the target.

For example, if you set it up as follows, users who access two pages (access to either one) are excluded from the campaign target.

The same applies when only entering a subdirectory.

The following URLs cannot match any of the conditions and are excluded from the experience display target.

```
https://abc.com/company/login
https://abc.com/company/checkout
https://abc.com/company/campaign1
https://abc.com/company/login/checkout/campaign1
```

## Prefix Match

Define URLs where the registered character string matches the beginning of the URL.

This is often used when URLs containing query parameters are the target.

For example, suppose the following URL is issued when a specific visitor (id=9982251615) visits.

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

If you register the above URL with a prefix match, visits from users other than id=9982251615 are not defined as the target.

If you want to limit to page=1 and target all user IDs, register the following URL with a prefix match.

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

Also, if you want to include pages other than page=1 in the measurement target, register the following URL with a prefix match.

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

## Suffix Match

Define URLs where the registered character string matches the end of the URL.

For example, if you register "`/test/index.html`" with a suffix match, the following URLs are defined as the target.

```
http://www.example.com/s/test/index.html 
```

In this case, the following URL with a different prefix string is also defined as the target.

```
http://www.123.com/s/test/index.html
```

However, the following URL is not defined as the target because the suffix is not "/test/index.html".

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

## Exact Match

Define URLs that match exactly, word for word, with the registered URL.

## Regular Expression

Regular expressions are a way of expressing multiple character strings in a single format.

By using regular expressions, you can define conditions with greater flexibility.

### **Regular Expression Grammar**

Regular expressions are used to search for strings that match a regular expression pattern from large amounts of data.

Special symbols are used to specify conditions for definition.

These are called special characters or metacharacters and can be categorized mainly into wildcards, anchors, and grouping.

Each is explained below.

**Wildcards**

**Anchors**

**Grouping**

**Other**

### Common Regular Expression Combinations

When the domain prefix matches exactly and ends with / or ? parameters

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

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

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

When you want to group URLs that contain http or https and subdomains

```css
Regular Expression:
^(http|https):\/\/(sh|bj|tj).ptmind.com

Included URLs:
http://sh.ptmind.com
http://bj.ptmind.com/abc
http://tj.ptmind.com
https://sh.ptmind.com
https://bj.ptmind.com/?WT.mc_id=xxxx
https://tj.ptmind.com

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

When you want to group by the same subdirectory

```css
Regular Expression:
^http:\/\/ptmind\.com\/price.*$

Included URLs:
http://ptmind.com/price/page
http://ptmind.com/price?sid=23fwe3r2&vid=345666
http://ptmind.com/price#top
http://ptmind.com/price

Excluded URLs: None
```

When you want to group URLs that contain http or https and have the same main domain in the same subdirectory

```css
Regular Expression:
^(http|https):\/\/[a-z0-9]*[.]*ptmind.com\/service\/mng_units\/lp03$

Included URLs:
http://www.ptmind.com/service/mng_units/lp03
https://www.ptmind.com/service/mng_units/lp03
http://ptmind.com/service/mng_units/lp03
http://a123.ptmind.com/service/mng_units/lp03
https://ptmind.com/service/mng_units/lp03

Excluded URLs:None
```

When you want to group URLs where the id is in a specific range (6984604 to 6984783)

```css
Regular Expression:
^http:\/\/ptmind.com\/detail\/id=6984([6][1-9][0-9]|[6][0][4-9]|[7][0-7][0-9]|[7][8][0-3])$

Included URLs:
http://ptmind.com/detail/id=6984604
http://ptmind.com/detail/id=6984783

Excluded URLs:
http://ptmind.com/detail/id=6984784
http://ptmind.com/detail/id=6984603
```

#### Regular Expression Validation Tool

You can verify whether your regular expression syntax is correct using tools like [this](/en/faq/others/matching-rules.md).

※ If you have any questions during setup, please feel free to contact us via the in-product chat.


---

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