Golang: extract data with Regex

后端 未结 4 932
萌比男神i
萌比男神i 2021-02-12 16:00

I\'m trying to extract whatever data inside ${}.

For example, the data extracted from this string should be abc.

git commit -m          


        
4条回答
  •  长发绾君心
    2021-02-12 16:31

    Try re := regexp.MustCompile(\$\{(.*)\}) * is a quantifier, you need something to quantify. . would do as it matches everything.

提交回复
热议问题