$css = file_get_contents("http://generals.mobi/styles/main.css");
preg_match_all('/url\("(.+?)"\)/', $css, $arr);
foreach ($arr as $e) {
$e = preg_replace('/url\("/', "", $e);
$e = preg_replace('/"\)/', "", $e);
print_r($e);
}
package main
import (
"fmt"
"regexp"
"strings"
)
func main() {
var data string = `<if> {{t}} </if> {{s}}
<if> {{gg}} </if>`
var replace = map[string]string{
"t": "te",
"s": "ss",
"gg": "гг",
}
for key, value := range replace {
data = strings.Replace(data, "{{"+key+"}}", value, 2)
}
re := regexp.MustCompile("<if>(.*?)</if>")
if_array := re.FindAllString(data, -1)
fmt.Println(if_array[0] + "\n")
fmt.Println(if_array[1] + "\n")
}