Go's regexp package does not support backtracking because it uses a Thompson NFA algorithm that guarantees linear-time performance, preventing catastrophic backtracking on complex patterns. This design choice prioritizes predictable execution speed over supporting features like lookaheads or backreferences that require backtracking.
// This pattern works fine (no backtracking needed)
re := regexp.MustCompile(`^[a-z]+$`)
// This pattern fails (lookahead requires backtracking)
// re := regexp.MustCompile(`(?=.*[a-z])`) // Error: invalid regexp