473,657 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3854
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3024
by: Adam | last post by:
Hi, I am trying to mark consective numbers in a data set and get a count as to how many consecutive numbers exist in the a given line of data. Here is an example line: 3, 5, 7, 9, 10, 13, 14 The relevant part of the script which currently checks for a
3
2366
by: jr | last post by:
A perplexing one this. I Am trying to design a query or series of queries which will firstly identify a condition. If column A value is less than column B value make column C value =1 , else 0. This is easy enough Then I want to identify all rows where column C = 1 ,
2
3848
by: jason | last post by:
Hello. I just converted some data to to sql2000 into a TEXT type field. I needed to remove all tabs from the data and now want to remove extra lines too. As we know, SQL2000's replace function does not work on TEXT types. So I've written a simple asp.net program (with very high timeouts) that allows me to replace strings in these very large Text fields. I loop through the table and am able to replace any strings I want except I can't...
6
8943
by: shaveta | last post by:
pls help me to write a program such that we input an integer x,where x>0. For x, the program has to convert it into the sum of consecutive positive integers. for e.g. let x=10 output should be "10= 1+2+3+4" the total no. of consecutive positive integers in the sum expression should be maximal. for e.g. if x= 9 result should be 2+3+4 and not 4+5. If x=4 , the output should be "no answer" thanx in advance
2
1847
by: TroyB | last post by:
I am trying to be able to get report of all "employees" that have had 5 consecutive days off from a "date" field in a current table. Normally I would do this by adding the sum of two dates, however in this case I only have one date for each entry. Below is an example of the data table I am using to get this type of information: John Doe 1/2/06 John Doe 1/3/06 Guy Day 5/4/06 Guy Day 6/22/06 The...
2
1961
by: Michael21622 | last post by:
pls help me to write a program such that we input an integer x,where x>0. For x, the program has to convert it into the sum of consecutive positive integers. for e.g. let x=10 output should be "10= 1+2+3+4" the total no. of consecutive positive integers in the sum expression should be maximal. for e.g. if x= 9 result should be 2+3+4 and not 4+5. If x=4 , the output should be "no answer" thanx in advance
6
2926
by: cesco | last post by:
Hi, say I have a vector like the following: vec = and I'd like to know via a function (for example, ConsecutiveIntegers(vec, N)) whether there are N consecutive integers. So, for example, if N=3 then ConsecutiveIntegers(vec, N) should return true because 1, 2, 3 and 5, 6, 7 are consecutive. If N=4, then
6
2453
by: chromis | last post by:
Hi, I'm trying to remove line breaks from a user-inputted string and trying to do this using ereg_replace and a regular expression but struggling, hope someone can help! I would like to make all triple or more consecutive occurences of \n, \n\n. So if the pattern found \n\n\n or \n\n\n\n and so on it would replace with \n\n. My plan is then to split() the string into an array using the double linebreak and then output each array member...
16
2385
by: sloan | last post by:
Current Framework 2.0/3.0. ... In Sql Server, there is a way to generate consecutive guid's. newsequentialid. Is there a way to reproduce this type of consecutive guid's in the framework.
8
12940
by: gigonomics | last post by:
Hi all, I hope someone can help me out. I need to return the best available seats subject to the constraint that the seats are side by side (or return X consecutive records from a table column where the values are integers). I can do this programmatically (using code and stored procedures), but it's not a neat solution and there are also performance issues. Returning the best available X number of seats is very straightforward. But I...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.