Using the new Regex library:
Code:
'Regex1 is a Regex object and Match1 is a Match object.
Sub Globals
End Sub
Sub App_Start
Match1.New1
Regex1.New1("(?<=^\s*)\w.*\w|\w(?>=\s*)")
Msgbox(Trim(" some string with spaces "))
End Sub
Sub Trim(s)
Match1.Value = Regex1.Match(s)
Return Match1.String
End Sub