On 28/07/2012 02:38, Todd Tabern wrote:
I'm looking to search an entire XML file for specific text and replace that
text, while maintaining the structure of the XML file. The text occurs within
multiple nodes throughout the file.
I basically need to replace every occurrence C:\Program Files wit
On 28/07/12 02:38, Todd Tabern wrote:
I'm looking to search an entire XML file for specific text and replace that
text,
> while maintaining the structure of the XML file.
Do you mean the physical layout of the file or the technical XML
structure? I'm assuming its the latter? If it's the forme
On Jul 28, 2012 2:39 AM, "Todd Tabern" wrote:
>
> I'm looking to search an entire XML file for specific text and replace
that text, while maintaining the structure of the XML file. The text occurs
within multiple nodes throughout the file.
> I basically need to replace every occurrence C:\Program
I'm looking to search an entire XML file for specific text and replace that
text, while maintaining the structure of the XML file. The text occurs within
multiple nodes throughout the file.
I basically need to replace every occurrence C:\Program Files with C:\Program
Files (x86), regardless of
> > Slightly more robust is the '\b' boundary assertion pattern:
>
> And I never understood why there were two...
>
> Which begs the question: under what circumstance would we prefer
> to use \W instead of \b?
In terms of code:
##
>>> import re
>>> re.search(r'(\W\w+\W)', 'hello|||').gro
>> Specifically \W signifies a word boundary so
>>
> Using the non-word pattern '\W' will work except in cases where we're
> right at the edge:
Sneaky! I didn't know that...
> Slightly more robust is the '\b' boundary assertion pattern:
And I never understood why there were two...
Which begs th
> regex allows us to specify certain conditions in the patterns
> such as whether the characters are digits etc, and also whether
> we are kooking for a word which is wat you want.
> Specifically \W signifies a word boundary so
>
> \Whello\W
>
> will find hello as a word.
Hi Alan,
Using the non-
Hi tak,
> hello, Othello. # just the hello and not Othello
One simplistic approach that does not use regex is to search for
spaces as part of the string. But that doesn't work for punctuation
nor at the start or end of lines.
So that leaves us, as you observed, with regular expressions.
regex a
> I have a problem finding specific words.
> I would like to filter out a word or replace it in a file.
> I notices that the re module is good for finding patterns.
Hi Tak,
Although regular expressions might be overkill for this problem, it can't
hurt to know about the Regex HOWTO:
http://
Hello,
I have a problem finding specific words.
I would like to filter out a word or replace it in a file.
I notices that the re module is good for finding patterns.
I am trying to filter out a word from strings, but having a little trouble.
I was wondering if I can search a string for a specific
Reed L. O'Brien wrote:
>I ma trying to write a script to search adn replace a sizable chink
of
>text in about 460 html pages.
>It is an old form that usesa search engine no linger availabe.
>
Well in the vein of Kents suggestion there is
http://www.crummy.com/software/BeautifulSoup/ however it wi
Reed L. O'Brien wrote:
> I ma trying to write a script to search adn replace a sizable chink of
> text in about 460 html pages.
> It is an old form that usesa search engine no linger availabe.
>
> I am wondering if anyone has any advice on the best way to go about that.
> There are more than one l
I ma trying to write a script to search adn replace a sizable chink of
text in about 460 html pages.
It is an old form that usesa search engine no linger availabe.
I am wondering if anyone has any advice on the best way to go about that.
There are more than one layout place ment for the form, but
13 matches
Mail list logo