func nameToRegexp(name string, useUnicode bool) *regexp.Regexp {
	// escape specific regex characters
	name = regexp.QuoteMeta(name)

	name = strings.ToLower(name)

	// handle path separators
	const separator = `[` + separatorChars + `]`

	// performance optimisation: only use \p{L} is useUnicode is true
	notWord := reNotLetterWord
	if useUnicode {
		notWord = reNotLetterWordUnicode
	}

	reStr := strings.ReplaceAll(name, " ", separator+"*")
	reStr = `(?:^|_|` + notWord + `)` + reStr + `(?:$|_|` + notWord + `)`

	re := regexp.MustCompile(reStr)
	return re
}
// nameToRegexp compiles a regexp pattern to match paths from the given name.
// Set useUnicode to true if this regexp is to be used on any strings with unicode characters.
nameToRegexp compiles a regexp pattern to match paths from the given name.
Set useUnicode to true if this regexp is to be used on any strings with unicode characters.
// nameToRegexp compiles a regexp pattern to match paths from the given name . // Set useUnicode to true if this regexp is to be used on any strings with unicode characters .
func nameToRegexp(name string, useUnicode bool) *regexp.Regexp {
	name = regexp.QuoteMeta(name)
	name = strings.ToLower(name)
	const separator = `[` + separatorChars + `]`
	notWord := reNotLetterWord
	if useUnicode {
		notWord = reNotLetterWordUnicode
	}
	reStr := strings.ReplaceAll(name, " ", separator+"*")
	reStr = `(?:^|_|` + notWord + `)` + reStr + `(?:$|_|` + notWord + `)`
	re := regexp.MustCompile(reStr)
	return re
}
func nameToRegexp ( name string , useUnicode bool ) * regexp . Regexp { name = regexp . QuoteMeta ( name ) name = strings . ToLower ( name ) const separator = `[` + separatorChars + `]` notWord := reNotLetterWord if useUnicode { notWord = reNotLetterWordUnicode } reStr := strings . ReplaceAll ( name , " " , separator + " " ) reStr = `(?:^|_|` + notWord + `)` + reStr + `(?:$|_|` + notWord + `)` re := regexp . MustCompile ( reStr ) return re }
nameToRegexp compiles a regexp pattern to match paths from the given name.
nameToRegexp compiles a regexp pattern to match paths from the given name .
// escape specific regex characters // handle path separators // performance optimisation: only use \p{L} is useUnicode is true