|
1234567891011 |
- package md
-
- import (
- "regexp"
- )
-
- func ReplaceImgUrl(val, host string) string {
- pattern := "\"([" + `\w` + ".=-\u4e00-\u9fa5]+).(png|jpg|jpeg|gif)"
- r := regexp.MustCompile(pattern)
- return r.ReplaceAllString(val, `"`+host+"/$1.$2")
- }
|