Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Replace consecutive "-" chars with a single character

98 views
Skip to first unread message

Gabriela

unread,
Feb 24, 2008, 8:46:14 AM2/24/08
to
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.

Martin Honnen

unread,
Feb 24, 2008, 9:45:16 AM2/24/08
to
Gabriela wrote:

Dim s As String = "Gabriela---Hello--How----Are-You"
s = Regex.Replace(s, "-{2,}", "-")

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

rowe_newsgroups

unread,
Feb 25, 2008, 7:16:18 AM2/25/08
to
> 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]

0 new messages