package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)#[NCRLTBUIOSFAGKP]\{(\d+):(#[NCRLTBUIOSFAGKP]\{\d+(?:;F)?\}|S|C|R)(:\d+)?\}`)
var str = `Ejemplos Válidos:
Ejemplo 1: #A{4:#S{520}:1}
Ejemplo 2: #A{4:#S{520;F}:2}
Ejemplo 3: #A{4:#S{520}:5}
Ejemplo 4: '#A{4:#S{520;F}:8}'!=''
Ejemplo 5: '#A{4:#S{520}:7}'!=''
Ejemplo 6: '#A{4:#S{520;F}:4}'=='A'
Ejemplos Inválidos:
Ejemplo 1: #A{354:#S{500;F}:1:F}
Ejemplo 2: #A{354;#S{500;F};1}
Ejemplo 3: #S{500`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/