# Handling Overlapping URLs in Screen Mapping

When defining screen mappings based on URLs, overlapping patterns can result in unintended page tagging. This document explains how to manage these overlaps by refining matching rules.

### Example Scenario

Consider the following URLs in a screen mapping system:

* `example.domain.com/report`
* `example.domain.com/reports-creator`

By default, a system might tag `example.domain.com/reports-creator` with both "report" and "reports-creator" due to the overlap. While acceptable in some cases, precise tagging is often required.

### Solution: Adjusting Matching Rules

To prevent `example.domain.com/reports-creator` from being tagged as "report," modify the matching rule to explicitly exclude overlapping pages.

#### **Updated Matching Rule**

```json
{
  "matching_criteria": {
    "rule_engine_rule": "url and not [w for w in context['in_url'] if w not in url] and not [w for w in context['not_in_url'] if w in url]",
    "context": {
      "in_url": [
        "example.domain.com/report"
      ],
      "not_in_url": [
        "reports-creator",
        "other-pages-with-overlap"
      ]
    }
  }
}
```

#### Explanation of the Rule

* Ensures the page URL matches one of the specified values in `in_url`.
* Excludes URLs listed under `not_in_url`.
* The "context" section defines:
  * **`in_url`**: URLs to be matched (`example.domain.com/report`).
  * **`not_in_url`**: Specific pages to exclude (`reports-creator`, `other-pages-with-overlap`).

#### Expected Outcome

* `example.domain.com/report` is tagged as "report."
* `example.domain.com/reports-creator` is only tagged as "reports-creator."

#### Alternative Approach

If allowing multiple tags is acceptable, leave the default configuration, which tags `example.domain.com/reports-creator` with both labels.

### Conclusion

By adjusting `matching_criteria`, URL categorization can be controlled, preventing unwanted overlaps.
