Dim strPattern As String: strPattern = "[^a-zA-Z0-9]"
Dim regex As New RegExp
regex.Pattern = strPattern
result = regex.Replace(pFileNameWithoutExtension, "_")
It does work but it replace only 1 char. How can I replace more than one char. Example : "ÉPÉ" should be "P" but currently the result is : "_PÉ"?
You just need to enable global pattern matching.
Dim strPattern As String: strPattern = "[^a-zA-Z0-9]"
Dim regex As New RegExp
regex.Global = True
regex.Pattern = strPattern
result = regex.Replace(pFileNameWithoutExtension, "_")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With