package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<!\d)\d{8}_\d{6}(?!\d)(*SKIP)(*F)|_`)
var str = `Patate_17890505_TitreEnCamelCase.ext
EPFL_AlgebreLineaire
TaxonomieProprietesFonctionsComplexes.v0.ipe.20210302_005606.pdf
1_
12_
_1
_12
12345678_
_123456
12345678_12345
1234567_123456
1234567_12345
123456_12345
12345678_1234567
123456789_123456
123456789_1234567
_patate__truc__
___
foo_12345678
foo_12345678_123456_bar
12345678_123456
foo12345678_123456bar`
var substitution = "."
fmt.Println(re.ReplaceAllString(str, substitution))
}
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/