---
title: "invalid-regexp"
description: "Detect invalid constant regular expressions."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# invalid-regexp

**Default severity:** `error`

Reports invalid constant patterns passed to regular-expression compilation and
matching functions. Dynamic patterns are checked at runtime by the standard
library and are not reported.

## Bad

```go
regexp.MustCompile(`[a-z`)
```

## Good

```go
regexp.MustCompile(`[a-z]+`)
```

Source: https://strider.gempir.com/analyzers/invalid-regexp/index.mdx
