2013-11-04 43 views
0

嘗試過爲負回顧後發正則表達式拖放到Phing replaceregexp任務,並收到錯誤:在Phing replaceregexp任務中可以使用否定lookbehind?

BUILD FAILED 
Error reading project file [wrapped: C:\path\to\build.xml:110:29: > required] 
Total time: 0.4800 seconds 

我看到尖括號是在XML的一個問題。有沒有一種方法可以在構建文件中指定否定的lookbehind正則表達式,還是用於自定義任務的東西?

我的目標是在文件重命名引用到「.js文件」,同時保留所有現存」 .min.js'涉及使用沒有什麼不同的東西:

(<script)(.*)(src=\")(.*)(?<!\.min)(\.js\") 

回答

0

刪除正則表達式到屬性文件:

minify_path_regex=(<script)(.*)(src=\")(.*)(?<!\.min)(\.js\") 

然後引用:

<copy todir="${builddir}/custom_errors" > 
    <filterchain> 
     <replaceregexp> 
      <regexp pattern="${minify_path_regex}" replace="\1\2\3\4.min\5" /> 
     </replaceregexp> 
    </filterchain> 
    <fileset refid="allPages" /> 
</copy> 

但是,如果有一種方法來規避X毫升/支架問題內聯我仍然很想知道。

相關問題