?
Solved

Replace Double Character with Single Character

Posted on 2008-11-17
3
Medium Priority
?
437 Views
Last Modified: 2012-05-05
if I have a string

string a = "ee-----ee--ee----ee-";

and I wanted the string to be

string a = "ee-ee-ee-ee";

what regex expression would I use?

I have tried a variety combos without success, any ideas?

a = Regex.Replace(a, "[-]?", "-");
0
Comment
Question by:addicktz
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
ozo earned 2000 total points
ID: 22982500
Regex.Replace(a, "-+", "-");
0
 
LVL 1

Author Comment

by:addicktz
ID: 22982506
gives me the same results as the original string, any other ideas?
0
 
LVL 1

Author Comment

by:addicktz
ID: 22982509
ack. nevermind =]
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses
Course of the Month13 days, 18 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question