Solved

need regular expression

Posted on 2004-08-02
4
198 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
transaction in asp.net, sql server 6 47
parse string in c# 5 29
C# DataTable (in memory) vs SQL Lookups 4 36
C# LINQ 5 25
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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