Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
Created·2023-04-21 10:28
Flavor·Golang

`
^((.{0,4})|(/api[^/].*)|(/ap[^i].*)|(/a[^p].*)|(/[^a].*))$
`
gm
Open regex in editor

Description

Aquivalent solution for golang's unsupported negative lookahead in re2 flavor of go's regex. This example provides a negative lookahead similar to (?!/api/) ignoring routes with the /api/ prefix at the start.

Submitted by misha