469,126 Members | 1,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,126 developers. It's quick & easy.

Replace consecutive "-" chars with a single character

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.
Feb 24 '08 #1
2 3464
Gabriela wrote:
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,}", "-")

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Feb 24 '08 #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]
Feb 25 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Adam | last post: by
2 posts views Thread by jason | last post: by
6 posts views Thread by cesco | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.