Java或ANT下的正则表达式中输出换行符
的 ant 目标,
<target name="regexp.replace">
<replaceregexp file="${file.temp}"
match="(.*)"
replace="first operation on \1 second operation on \1"
byline="true"/>
</target>
我有调用replaceregexp 任务file.temp
A1
A2
所需的输出是
first operation on A1
second operation on A1
first operation on A2
second operation on A2
插入什么作为新行字符以在 ant Replaceregexp 参数中生成所需的输出?
replace="first operation on \1 %NEW_LINE% second operation on \1"
I have ant target that invokes replaceregexp task
<target name="regexp.replace">
<replaceregexp file="${file.temp}"
match="(.*)"
replace="first operation on \1 second operation on \1"
byline="true"/>
</target>
file.temp is
A1
A2
desired output is
first operation on A1
second operation on A1
first operation on A2
second operation on A2
What to insert as new line char for producing desired output in ant replaceregexp parameter?
replace="first operation on \1 %NEW_LINE% second operation on \1"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下对我有用:
The following works for me: