I'm looking for a regular expression to eliminated punctuation and special characters. Is there a way to get a regular expression to match \W and ignore the white spaces?
I have a VBA script that's working just find (I'm happy to share if necessary), but I think I'm just missing something simple. When I run the code, it definitely works, but the strPattern = "\W" is grabbing spaces as well. I know I can use the \S option, but I can't seem to get it to perform an AND, so to speak.
Code:
Sub RegEx_Pattern_Removal()
    Dim strPattern As String: strPattern = "\W"
    Dim strReplace As String: strReplace = ""
    Dim regEx As New RegExp
    Dim strInput As String
    Dim myRange As Range
    'Application.ScreenUpdating = False
    Set myRange = Application.Selection
    With regEx
        .Global = True
        .MultiLine = True
        .IgnoreCase = False
        .Pattern = strPattern
    End With
    For Each Cell In myRange
        If Cell.Value <> Empty Then
            strInput = Cell.Value
            If regEx.Test(strInput) = True Then
                Cell.Value = regEx.Replace(strInput, strReplace)
                MsgBox "It's a match, baby!"
            Else
                MsgBox "No Match! Or... you fucked up"
            End If
        End If
    Next
    'Application.ScreenUpdating = True
End Sub
