I trying to use regex in golang.
This i was expecting the regex below to return false, However its returing true. What am i doing wrong with the regex. I tested this regex on https://regex101.com/ it should not return true. But in golang it returns true
My goal was to find a regex for /v2/echo/{asd}/te-st?start_date=2024-01-01
I created this ^(?:/[a-zA-Z0-9_{}?=-]+)+
it works fine on regex101
package main
import (
"fmt"
"regexp"
)
func main() {
regExp, err := regexp.Compile("^(?:\/[a-z]+)+")
if err != nil {
panic(err)
}
fmt.Println(regExp.MatchString("/v2/echo/{asd}/te-st?start_date=2024-01-01"))
}
I was expecting fmt.Println(regExp.MatchString("/v2/echo/{asd}/te-st?start_date=2024-01-01"))
to return false