---
title: "Pattern matching in the <span class=\"fr-alt\" title=\"You can edit the router configuration over REST at the config/router endpoint.\">router configuration</span>"
description: Pattern matching can minimize overhead in the router service. The default router configuration includes instances of the pattern filter object, that limit script requests to specified methods and endpoints.
component: pingoneaic
page_id: pingoneaic:idm-scripting:script-pattern-match
canonical_url: https://docs.pingidentity.com/pingoneaic/idm-scripting/script-pattern-match.html
---

# Pattern matching in the router configuration *(tooltip: You can edit the router configuration over REST at the config/router endpoint.)*

Pattern matching can minimize overhead in the router service. The default router configuration *(tooltip: You can edit the router configuration over REST at the config/router endpoint.)* includes instances of the `pattern` filter object, that limit script requests to specified methods and endpoints.

Based on the following code snippet, the router service would trigger a script for `CREATE` and `UPDATE` calls to managed and internal objects:

```json
{
    "pattern" : "^(managed|internal)($|(/.+))",
    "onRequest" : {
        "type" : "text/javascript",
        "source" : "require('policyFilter').runFilter()"
    },
    "methods" : [
        "create",
        "update"
    ]
}
```

Without this `pattern`, IDM would apply the policy filter to additional objects, such as the audit service, which could affect performance.
