fabric/fabric — Issue #483: Search consistency between fabric.contrib.files.contains and fabric.contrib.files.sed
Author: franckbret
Created: 2011-11-18 14:39:52+00:00
State: open

It's a common case to have to search and delete string patterns within file. Obviously without special chars in single line it works fine :-)

Now here is the problem, and as you can imagine it's special chars and multilines related ;-)

Before all I want to be sure that the file contains the string pattern, so I use fabric.contrib.files.contains. If it contains it, I need to search and delete, so find the pattern and replace with an empty string.

Ok, will use fabric.contrib.files.sed to do that, and surprise.

Contains find the pattern and returns True, It's OK...
Sed gives errors searching it... Maybe I miss something, and I understand that's it's hard to manage all the possible cases with special chars, but I was hopping that if iles.contains can find the pattern, files.sed will find it too.

http://dpaste.com/hold/658645/