Jesse Houwing
5/2/2008 11:21:00 AM
Hello Barry,
> Thanks Jesse
>
> It does the replace in the entire xml file.
>
You're welcome :)
Jesse
> Barry
>
> "barry" <someone@somewhere.com> wrote in message
> news:%23teNvwDrIHA.3940@TK2MSFTNGP03.phx.gbl...
>
>> Hello Jesse
>>
>> Will this work on a entire XML file (it has over 20,000 lines) and
>> there are many lines with such problems. The acutal job is long over,
>> i am only trying to understand regex in such cases.
>>
>> Barry
>>
>> "Jesse Houwing" <jesse.houwing@newsgroup.nospam> wrote in message
>> news:21effc90535268ca7a5afde26e27@news.microsoft.com...
>>
>>> 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@totallybogus.com> wrote in message
>>>> news:e20WY2sqIHA.4476@TK2MSFTNGP04.phx.gbl...
>>>>
>>>>> 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@somewhere.com> wrote in message
>>>>> news:eIDvCEsqIHA.2520@TK2MSFTNGP02.phx.gbl...
>>>>>> 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@somewhere.com> wrote in message
>>>>>> news:Ot5OGUgqIHA.4912@TK2MSFTNGP03.phx.gbl...
>>>>>>> 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
--
Jesse Houwing
jesse.houwing at sogeti.nl