# Contains Url Check Examples

Source: https://userguide.qualytics.io/data-quality-checks/contains-url/deep-dive/examples/

Three real-world scenarios that show how the Contains Url check is typically used in production: validating a product image column, checking link attachments with a filter, and auditing a legacy column mid-cleanup. The first two run at 100% coverage and report Record Anomalies; the third lowers coverage and reports a Shape Anomaly instead.

**Tab: Product Image Column**

**The situation:** The `products` table stores the canonical image location in `image_url`. Rows holding a file name, a note, or an internal path break every storefront and feed that reads the column.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Contains Url |
| Field | `image_url` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Catalog Data team)* |
| Description | Product image column must hold a URL. |
| Tags | `catalog`, `format` |
| Additional Metadata | `jira: DATA-7401` |
| Status | Active |

**Payload**

```json
{
    "description": "Product image column must hold a URL.",
    "rule": "containsUrl",
    "fields": ["image_url"],
    "container_id": 520,
    "coverage": 1,
    "filter": null,
    "properties": {},
    "tags": ["catalog", "format"],
    "additional_metadata": {"jira": "DATA-7401"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 22
}
```

**Sample Data**

| product_id | image_url | status |
| --- | --- | --- |
| SKU-001 | https://cdn.example.com/a.jpg | active |
| SKU-002 | a.jpg | active |
| SKU-003 | https://cdn.example.com/c.png | active |
| SKU-004 | *(null)* | draft |

**What gets flagged**

Product `SKU-002` holds a bare file name instead of a location. `SKU-004` is NULL and passes without firing an anomaly. Coverage is 100%, so the failing row is reported as a Record Anomaly.

> **Example: Record Anomaly**
>
> image_url has the value a.jpg, which does not contain a URL

**Flowchart**

```mermaid
graph TD
    A["No filter, evaluate all rows"] --> B["Read image_url as text"]
    B --> C{"Is value NULL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E{"Does it contain<br/>a URL?"}
    E -->|Yes| D
    E -->|No| F["Flag row.<br/>Record Anomaly per failing row."]
```

**Equivalent SQL**

```sql
-- Rows the Contains Url check would flag.
SELECT p.*
FROM products p
WHERE p.image_url IS NOT NULL
  AND p.image_url NOT RLIKE '<url pattern>';
```

**Tab: External Links Only, with Filter**

**The situation:** The `attachments` table mixes external links with uploaded files. Only rows of type `link` must carry a URL in `location`; uploaded files hold storage keys and are out of scope.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Contains Url |
| Field | `location` |
| Filter | `attachment_type = 'link'` |
| Custom Anomaly Description | Off |
| Coverage | 100% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Content Platform)* |
| Description | Link attachments must carry a URL. |
| Tags | `content`, `format` |
| Additional Metadata | `jira: DATA-7433` |
| Status | Active |

**Payload**

```json
{
    "description": "Link attachments must carry a URL.",
    "rule": "containsUrl",
    "fields": ["location"],
    "container_id": 521,
    "coverage": 1,
    "filter": "attachment_type = 'link'",
    "properties": {},
    "tags": ["content", "format"],
    "additional_metadata": {"jira": "DATA-7433"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 22
}
```

**Sample Data** (filtered to `attachment_type = 'link'`)

| attachment_id | attachment_type | location |
| --- | --- | --- |
| A-01 | link | https://docs.example.com/spec |
| A-02 | link | ask the team |
| A-03 | link | http://example.org/policy |

**Why the filter matters**

The filter runs **before** the evaluation, so uploaded files are never tested for a URL. Only link attachments are evaluated.

**What gets flagged**

`A-02` holds a note instead of a location, so it is the only row reported. Coverage is 100%, so the failure is reported as a Record Anomaly, and the message names the filter that scoped the evaluation.

> **Example: Record Anomaly**
>
> location has the value ask the team, which does not contain a URL (applied to records where attachment_type = 'link')

**Flowchart**

```mermaid
graph TD
    A["Apply filter: attachment_type = 'link'"] --> B["Read location as text"]
    B --> C{"Does it contain<br/>a URL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E["Flag row.<br/>Message names the filter:<br/>applied to records where attachment_type = 'link'"]
```

**Equivalent SQL**

```sql
-- Rows the check would flag among link attachments.
SELECT a.*
FROM attachments a
WHERE a.attachment_type = 'link'
  AND a.location IS NOT NULL
  AND a.location NOT RLIKE '<url pattern>';
```

**Tab: Legacy Column Mid-Cleanup**

**The situation:** A legacy `reference` column mixes links with free-text notes. A cleanup job is rewriting the bad rows, and a small fraction is expected to remain broken until it finishes, so the check tolerates up to 0.5% failures.

**Check configuration**

| Field | Value |
| --- | --- |
| Rule | Contains Url |
| Field | `reference` |
| Filter | *(none)* |
| Custom Anomaly Description | Off |
| Coverage | 99.5% |
| Owner | *(check creator)* |
| Anomaly Assignee | *(Legacy Migration team)* |
| Description | Legacy reference column must hold a URL. |
| Tags | `legacy`, `format` |
| Additional Metadata | `jira: DATA-7488` |
| Status | Active |

**Payload**

```json
{
    "description": "Legacy reference column must hold a URL.",
    "rule": "containsUrl",
    "fields": ["reference"],
    "container_id": 522,
    "coverage": 0.995,
    "filter": null,
    "properties": {},
    "tags": ["legacy", "format"],
    "additional_metadata": {"jira": "DATA-7488"},
    "anomaly_message_field": null,
    "template_id": null,
    "status": "Active",
    "owner_id": 7,
    "default_anomaly_assignee_id": 41
}
```

**Sample Data**

| doc_id | reference | migrated |
| --- | --- | --- |
| D-01 | https://intranet.example.com/policy | true |
| D-02 | shared drive | false |
| D-03 | n/a | false |
| D-04 | *(null)* | false |

**What gets flagged**

Documents `D-02` and `D-03` still hold free-text notes. `D-04` is NULL, so it passes without firing an anomaly but still counts in the scanned total. Only 50% of the rows pass, which is below the 99.5% coverage threshold, so the check reports a single Shape Anomaly for the dataset with a sample of the offending rows. Coverage below 100% does not produce Record Anomalies.

> **Example: Shape Anomaly**
>
> reference values do not contain a URL, affecting 2 of 4 asserted records

**Flowchart**

```mermaid
graph TD
    A["No filter, evaluate all rows"] --> B["Read reference as text"]
    B --> C{"Is value NULL?"}
    C -->|Yes| D["Row passes"]
    C -->|No| E{"Does it contain<br/>a URL?"}
    E -->|Yes| D
    E -->|No| F["Flag row.<br/>Passing rate falls below the 99.5%<br/>coverage, so one Shape Anomaly is reported."]
```

**Equivalent SQL**

```sql
-- Rows the check would flag.
SELECT d.*
FROM documents d
WHERE d.reference IS NOT NULL
  AND d.reference NOT RLIKE '<url pattern>';
```

## See Also

- **How It Works**

  The complete reference: definition, field scope, pattern matching, NULL handling, arrays, filter behavior, and coverage.

  [How It Works](https://userguide.qualytics.io/data-quality-checks/contains-url/deep-dive/how-it-works/)
- **Anomaly Reporting**

  The anomaly messages the check produces, what the numbers mean, Source Records highlighting, and Custom Anomaly Description.

  [Anomaly Reporting](https://userguide.qualytics.io/data-quality-checks/contains-url/deep-dive/anomaly-reporting/)
- **Best Practices**

  Guidelines for scoping the check, pairing rules, and keeping the signal clean.

  [Best Practices](https://userguide.qualytics.io/data-quality-checks/contains-url/deep-dive/best-practices/)
- **Permissions**

  The team permission each action needs: view, create, edit, archive, restore, and delete.

  [Permissions](https://userguide.qualytics.io/data-quality-checks/contains-url/deep-dive/permissions/)

*Last updated: September 22, 2026.*
