package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^https:\/\/vk\.com\/(?!album-?\d)[^\/]*$`)
var str = `https://vk.com/album9
https://vk.com/album123_456
https://vk.com/album-123
https://vk.com/a-tut_chot@@#$%$&-ugodno dazhe probely
Если пробелы запрещены, замените [^\/]* на [^\/\s]*
^https:\/\/vk\.com\/(?!album\d)[^\/\s]*$`
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/