Answer the question
In order to leave comments, you need to log in
How to write a regular expression equivalent to php in golang?
I can't figure out how to make a regular expression in Go:
preg_match('/config = {(.*?)};/', $response->body, $result);
Answer the question
In order to leave comments, you need to log in
MustCompile and MatchString
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`(gopher){2}`)
fmt.Println(re.MatchString("gopher"))
fmt.Println(re.MatchString("gophergopher"))
fmt.Println(re.MatchString("gophergophergopher"))
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question