[英]Output newline char in regexp under Java or ANT
我有調用replaceregexp任務的ant目標
<target name="regexp.replace">
<replaceregexp file="${file.temp}"
match="(.*)"
replace="first operation on \1 second operation on \1"
byline="true"/>
</target>
file.temp是
A1
A2
期望的輸出是
first operation on A1
second operation on A1
first operation on A2
second operation on A2
在ant replaceregexp參數中插入新行char以生成所需輸出的內容?
replace="first operation on \1 %NEW_LINE% second operation on \1"
以下適用於我:
<replaceregexp file="test.txt"
match="(.*)"
replace="first operation on \1${line.separator}second operation on \1"
byline="true"/>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.