Case Sensitive RegEx

Trying to do a search but when it encounters the first upper case search it changes both so I end up with both being uppercase .

Dim rg as New RegEx
Dim ro As New RegExOptions
ro.CaseSensitive = True
rg.Options = ro

      rg.searchPattern = "[\\w]"
      myMatch = rg.search(app.textArray(i))
      if myMatch <> nil then
        app.textArray(i) = app.textArray(i).replaceAll(""," ")
      end if
      
      rg.searchPattern = "[\\w]"
      myMatch = rg.search(app.textArray(i))
      if myMatch <> nil then
        app.textArray(i) = app.textArray(i).replaceAll(""," ")
      end if

The answer to your question:

rg.Options.CaseSenstive = True

// or

rg.SearchPattern = "(?-i)\\w"

Another way to do it:

rg.SearchPattern = "(\\w)()"
rg.ReplacementPattern = "$1 $2"
rg.Options.ReplaceAllMatches = True

TextArray( i ) = rg.Replace( TextArray( i ) )

You don’t need the square brackets around “\w” by the way.

I just tried rg.Options.CaseSensitive = True before you posted and it didn’t work. I then tried your “Another way” and that worked. Thanks Kem!