Regular Expressions 101

Community Library Entry

1

Regular Expression
Golang

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

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 - 2 years ago