I want a regex in such a way that to replace the filename which contains special characters and dots(.) etc. with underscore(_) except the extension of the filename.
Help me with an regex
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
try this:
with the insensitive flag “i”. Replace with ‘_’
The first lot of characters can be customised, or maybe use \W (any non-word)
so this reads as:
replace with ‘_’ where I match and of this set, or a period that is not followed by some characters or numbers and the end of line
Sample c# code: