---
url: >-
  https://lit-ui-router.dev/reference/ui-router-server/matcher/functions/urlMatcherFactory.md
---
[ui-router-server](../../index.md) / [matcher](../index.md) / urlMatcherFactory

# Function: urlMatcherFactory()

```ts
function urlMatcherFactory(config?): {
  compile: <M>(pattern, options?) => CompiledMatcher<M>;
};
```

Defined in: [url-matcher.ts:771](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/url-matcher.ts#L771)

Creates a matcher compiler — named for core's UrlMatcherFactory, whose
defaults it keeps: strict trailing-slash matching, case-sensitive,
percent-decoding on, and a default squash policy of false.

## Parameters

| Parameter | Type |
| ------ | ------ |
| `config?` | [`UrlMatcherCompilerConfig`](../interfaces/UrlMatcherCompilerConfig.md) |

## Returns

| Name | Type | Description | Defined in |
| ------ | ------ | ------ | ------ |
| `compile()` | <`M`>(`pattern`, `options?`) => [`CompiledMatcher`](../interfaces/CompiledMatcher.md)<`M`> | Compiles one pattern into a [CompiledMatcher](../interfaces/CompiledMatcher.md), with per-pattern [UrlMatcherCompileOptions](../interfaces/UrlMatcherCompileOptions.md). | [url-matcher.ts:773](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/url-matcher.ts#L773) |
