Cleanup SharePoint file and folder name with regex

SharePoint regex
SharePoint, like the file system, does not allow all characters in a file and folder name. Next to these characters there are also some limitations on the first characters of a name (e.g. _ makes it hidden) and you cannot use some endings.

I found some examples, but these didn’t work for me. So with the help of regexone.com and this StackExchange post, I created my own.

To be honest, this blog is just an easy place to find it again if I need it.

The code:

Regex is not something I’m very familiar with. So if anybody has a suggestion, please comment.

Leave a Reply

Your email address will not be published. Required fields are marked *