Hi!
The space is recognized, but in regexes parenthesis have special meaning, they create a group, and do not match the "()" character. (the handy regex resource I use for reference : http://www.amk.ca/python/howto/regex/ )
You'll have to escape the parenthesis for python to understand that you want to match the character, instead of creating a group. You may have encountered the same kind of issues with brackets, only [ will match [ when using the -regex parameter. """ python replace.py -regex " (from wikipedia)}}" "}}" -file:sfwn1e -log:sfwlog -summary:"adding argument to {{from wikipedia raw}} template - Step 2 of 2, change local pagename to Wikipedia pagename" """ will work.
Also, in this case, the -regex parameter is not necessary, because your appear to match a single given string. """ python replace.py " (from wikipedia)}}" "}}" -file:sfwn1e -log:sfwlog -summary:"adding argument to {{from wikipedia raw}} template - Step 2 of 2, change local pagename to Wikipedia pagename" """ will work all the same.
2009/2/18 Chris Watkins chriswaterguy@appropedia.org:
I'm trying to run this command:
python replace.py -regex " (from wikipedia)}}" "}}" -file:sfwn1e -log:sfwlog -summary:"adding argument to {{from wikipedia raw}} template - Step 2 of 2, change local pagename to Wikipedia pagename"
But I get the output:
No changes were necessary in [[Oral rehydration therapy (from Wikipedia)]]
for every file, even though this text is present in every file: (from wikipedia)}}
...including the leading space.
Do I need to use a special character to insert the space? (And regex?) I tried %20 instead of the space but it didn't work.
Thanks
-- Chris Watkins (a.k.a. Chriswaterguy)
Appropedia.org - Sharing knowledge to build rich, sustainable lives.
identi.ca/appropedia / twitter.com/appropedia blogs.appropedia.org
I like this: five.sentenc.es
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l