There’s a pure Go (no cgo needed) regexp engine that supports lookahead and lookbehind here: https://github.com/dlclark/regexp2
However, and I say this as someone who maintains that regex library, use this type of regex with caution. I would highly recommend changing your code to use the native, RE2-based engine if you can. Runaway regex’s on certain inputs is a risk with backtracking and is frequently a bad trade off in production. If you need compatibility because you don’t control the patterns being used or are porting code with lots of existing patterns (which is why the library exists) then regexp2 is nice to have in your back pocket. -Doug -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/d89d0c25-90ab-49a5-9281-f8db334b029c%40googlegroups.com.