Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reg Exp remove 1 space

Status
Not open for further replies.

matrixindicator

IS-IT--Management
Sep 6, 2007
418
BE
I have a regular expression to remove Control Signs.
"URB O PAZO 11  RARIS XESTELO."
become
"URB O PAZO 11 RARIS XESTELO."

But between 11 and RARIS is a space to much (two instead of one), how can I remove this ?

Code:
Dim re as New RegExp
Dim textNotOk, textOk as String
 
With re
   .Global = True
   .IgnoreCase = True
   .Multiline = True
   .Pattern = "[\x01-\x1f]"
End With
 
textOk = re.Replace(textNotOk, "")
 
Set re = Nothing
 
Code:
Do Until Len(textOK) = Len(Replace(TextOK, "  ", " "))
    textOK = Replace(TextOK, "  ", " ")
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top