Imports System.Text.RegularExpressions
Dim filename As String = "this is a terrible f^ln@me! that is (way) too long.txt"
Dim newFilename As String = Regex.Replace(filename, "[!@#$%^&*()_ ]", String.Empty).Substring(0, 26)
Console.WriteLine(newFilename)