---
title: NDM Tags with Regex
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Network Monitoring > Network Device Monitoring > NDM Guides > NDM Tags
  with Regex
---

# NDM Tags with Regex

Datadog Network Device Monitoring (NDM) supports regular expressions to create metric tags in the format `<KEY>:<VALUE>`.

## Setup{% #setup %}

### Installation{% #installation %}

Follow the [setup instructions](https://docs.datadoghq.com/network_monitoring/devices/snmp_metrics.md) to install Datadog Network Device Monitoring, and start collecting SNMP Metrics and Traps.

### Configuration{% #configuration %}

In the [SNMP conf.yaml](https://github.com/DataDog/integrations-core/blob/master/snmp/datadog_checks/snmp/data/conf.yaml.example), you can specify `metric_tags` from an OID. To create multiple tags for devices, use regular expressions to separate the resulting value into multiple tags, or get a substring using the regular [Python engine](https://docs.python.org/3/library/re.html).

#### OID{% #oid %}

The example below creates two tags using regex matching on the OID's value. So, if the OID's value is `41ba948911b9`, the tags `host_prefix:41` and `host:ba948911b9` are added to the corresponding metrics.

```yaml
    metric_tags:
     - # From an OID:
       symbol:
          OID: 1.3.6.1.2.1.1.5.0
          name: sysName
       match: (\d\d)(.*)
       tags:
           host_prefix: \1
           host: \2
```

The example below creates tags using regex for a table:

```yaml
metrics:
  - MIB: IF-MIB
    table:
      OID: 1.3.6.1.2.1.2.2
      name: ifTable
    symbols:
      - OID: 1.3.6.1.2.1.2.2.1.10
        name: ifInOctets
    metric_tags:
      - column':
          OID: 1.3.6.1.2.1.2.2.1.2
          name: ifDescr
        match: '(\w)(\w+)'
        tags:
         - prefix: '\1'
         - suffix: '\2'
```

## Further Reading{% #further-reading %}

- [Network Device Monitoring SNMP Metrics](https://docs.datadoghq.com/network_monitoring/devices/snmp_metrics.md)
- [Getting Started with Tags](https://docs.datadoghq.com/getting_started/tagging.md)
