Alex Rivera | Logout

find replace text in file with Phing

Asked 2011-02-05T14:34:38.503
16

Does anyone know how to find and replace text inside a file with Phing?

Edit
Report

1 Answer

30

If you don't want to copy files and just replace a string in the current folder where your files reside, do a reflexive task:

<reflexive>
    <fileset dir=".">
        <include pattern="*.js" />
    </fileset>
    <filterchain>
        <replaceregexp>
            <regexp pattern="SEARCH" replace="REPLACEMENT"/>
        </replaceregexp>
    </filterchain>
</reflexive>
answered 2011-11-08T09:20:36.280

Your Answer