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.
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
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)
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