Solved

need regular expression

Posted on 2004-08-02
4
195 Views
Last Modified: 2010-04-15
I suck at need regular expressions, can some one write one for me to:


I need a need regular expression to replace all charecters between > and < with a blank space.

example:    hi this is a sentence la la la >replace all this with a blank space< ok now onto writing more

Thanks,
Ed
0
Comment
Question by:CNTITDEPT
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Thogek earned 125 total points
ID: 11695700
Perhaps something along the lines of:

    System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(">.*<");
    string strChanged = Regex.Replace(strOriginal, "> <");
0
 
LVL 1

Author Comment

by:CNTITDEPT
ID: 11696100
Thogek:

That does not work, it does not find any matches
0
 
LVL 1

Author Comment

by:CNTITDEPT
ID: 11696600
Thogek:
One mistake in your code:

string strChanged = Regex.Replace(strOriginal, "> <");

should be:

string strChanged = reg.Replace(strOriginal, "> <");

Your way did not work untill I put it into a foreach statement, So now it does the job

Thanks,
Ed
0
 
LVL 15

Expert Comment

by:Thogek
ID: 11696635
Doh.  Sorry 'bout that.  But at least you figured it out.  :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now