Re: Regex Replace Help
- From: Jesse Houwing <jesse.houwing@xxxxxxxxxxxxxxxx>
- Date: Fri, 2 May 2008 09:01:22 +0000 (UTC)
Hello Barry,
Let's try to wriete out the pattern you're looking for.
You're specifically looking for a pattern that consists of an &, not followed by any alphanumeric characters and a ;. Now if you write it out like that, it becomes quite simple:
&(?![a-z0-9]+;)
That's it... Now, replace those with & and you're done.
Jesse
Thanks for your reply--
Imagine the following string
string str = "The Quick Black&Fox & Jumped Over "e; The & Lazy
Dog";
should be
string str = "The Quick Black&Fox & Jumped Over "e; The &
Lazy Dog";
This is a problem with a larger .xml file in which xx&xx is creating
a problems in IE
In fact in have just spent over 50 minutes and managed to get some
results like this
str = Regex.Replace(str, @"\b\s*(?=&[^&|"e;| & ])\b", "&",
RegexOptions.None);
And last but not the least i collect all answers posted to my Regex
queries for later use.
"eBob.com" <fakename@xxxxxxxxxxxxxxxx> wrote in message
news:e20WY2sqIHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
Hi Barry,
Actually I wanted to play around with this for you but just haven't
gotten around to it. (And, btw, I don't recall any previous posts
from you on this subject.)
Part of my response to you, the part I can provide without actually
playing with a regex, is the following. Regular Expressions are
extremely useful. If you do any programming the effort you put into
learning regular expressions will be worth it. Several of us here
use Expresso (from UltraPico) and recommend it. I just became aware
of something similar called Regular Expression Workbench available
from MSDN. I've installed it but have not yet played with it.
I'll try to play with it later today but no promises.
Bob
"barry" <someone@xxxxxxxxxxxxx> wrote in message
news:eIDvCEsqIHA.2520@xxxxxxxxxxxxxxxxxxxxxxx
strange, no one has replied
looks like i have crossed the limit of asking question on the same
topic. I the some limit maybe (10 or 15 per topic)
"barry" <someone@xxxxxxxxxxxxx> wrote in message
news:Ot5OGUgqIHA.4912@xxxxxxxxxxxxxxxxxxxxxxx
Hi
I have a files which contains
&
&
"e;
I want to replace & with & , but not & or "e;
Will someone please help with the Regular Expression.
TIA
Barry
Jesse Houwing
jesse.houwing at sogeti.nl
.
- Follow-Ups:
- Re: Regex Replace Help
- From: barry
- Re: Regex Replace Help
- Prev by Date: Re: Programatically create static network route
- Next by Date: Re: Regex Replace Help
- Previous by thread: Re: Regex Replace Help
- Next by thread: Re: Regex Replace Help
- Index(es):
Relevant Pages
|