Re: Need direction on mass find/replacement in HTML files

2010-05-01 Thread Novocastrian_Nomad
One single line regex solution would be: re.sub(r'http\://www.mysite.org/\?page=([^"]+)',r'pages/\1.htm',html) -- http://mail.python.org/mailman/listinfo/python-list

Re: Need direction on mass find/replacement in HTML files

2010-04-30 Thread Tim Chase
On 04/30/2010 02:54 PM, KevinUT wrote: I want to globally change the following: into: Normally I'd just do this with sed on a *nix-like OS: find . -iname '*.html' -exec sed -i.BAK 's...@href="http://www.mysite.org/?page=\([^"]*\)@href="pages/\1@g' {} \; This finds all the HTML file

Re: Need direction on mass find/replacement in HTML files

2010-04-30 Thread Peter Otten
KevinUT wrote: > Hello Folks: > > I want to globally change the following: > > into: > > You'll notice that the match would be http://www.mysite.org/?page= but > I also need to add a ".htm" to the end of "contacts" so it becomes > "contacts.htm" This part of the URL is variable, so how can I

Need direction on mass find/replacement in HTML files

2010-04-30 Thread KevinUT
Hello Folks: I want to globally change the following: into: You'll notice that the match would be http://www.mysite.org/?page= but I also need to add a ".htm" to the end of "contacts" so it becomes "contacts.htm" This part of the URL is variable, so how can I use a combination of Python and/or