try the following:
([!@#$%^&*()]|(?:[.](?![a-z0-9]+$)))
with insensitive flag "i". Replace '_'
The first batch of characters can be customized or maybe use \ W (any non-word)
so it looks like:
replace with "_", where I match, and this set, or the period that some characters or numbers do not follow, and the end of the line
C # code example:
var newstr = new Regex("([!@#$%^&*()]|(?:[.](?![a-z0-9]+$)))", RegexOptions.IgnoreCase)
.Replace(myPath, "_");
source
share