Replace consecutive "-" chars with a single character

  • Thread starter Thread starter Gabriela
  • Start date Start date
G

Gabriela

Hi,
I would like to use VBScript regexp to locate multiple characters in a
string and replace them with a single "-" char.
In my case it's multiple "-" chars:
E.g.: "Gabriela---Hello--How----Are-You" -->"Gabriela-Hello-How-Are-
You"
How is it done?
Thanks, Gabi.
 
Gabriela said:
I would like to use VBScript regexp to locate multiple characters in a
string and replace them with a single "-" char.
In my case it's multiple "-" chars:
E.g.: "Gabriela---Hello--How----Are-You" -->"Gabriela-Hello-How-Are-
You"
How is it done?

Dim s As String = "Gabriela---Hello--How----Are-You"
s = Regex.Replace(s, "-{2,}", "-")
 
I would like to use VBScript regexp

Martin has shown you how to do this in .NET, if you are truly needing
a vbscript example, you will need to go to the vbscript group and not
the .NET newsgroup.

Thanks,

Seth Rowe [MVP]
 
Back
Top