文件中包含以下行.我想从这个文件中提取多个数据.
Number of current user build lists: 23
- ‘RevisionBuild’ Run time (in minutes) = 8.40
[Build] RC = 0
我使用以下正则表达式从此文件中检索值23
<ac:for param="line" list="${logFileContent}" delimiter="${line.separator}"> <sequential> <propertyregex property="noOfBuildlists" input="@{line}" regexp="(.*)Number of current user build lists: (.*)$" select="\2"/> </sequential> </ac:for>
但是当我尝试获取其他行时,相同的正则表达式不会获取任何值
regexp =“(.)[revBuild] RC =(.)$”或regexp =“(.)’RevisionBuild’运行时间(以分钟为单位)=(.)$”其中提取的值分别为0和8.40.
有人可以帮忙吗?
谢谢,
Aarthi
我认为这是你感兴趣的.在下面的输入文件
Number of current user build lists: 23 'RevisionBuild' Run time (in minutes) = 8.40 [Build] RC = 0
当我执行低于目标
<project name="BuildModule" basedir="." default="extract.nums"> <taskdef resource="net/sf/antcontrib/antlib.xml" /> <property environment="env" /> <loadfile property="file" srcfile="${basedir}/inputLog.log"/> <target name="extract.nums"> <for param="line" delimiter="${line.separator}" list="${file}"> <sequential> <propertyregex property="noOfBuildlists" input="@{line}" regexp="Number of current user build lists:\s*([0-9]+)$" select="\1" /> <propertyregex property="revisionBuild" input="@{line}" regexp="'RevisionBuild' Run time\s*\(in minutes\)\s*=\s*([0-9\.]+)$" select="\1" /> <propertyregex property="rcBuild" input="@{line}" regexp="\[Build\] RC\s*\=\s*([0-9]+)$" select="\1" /> </sequential> </for> <echo message="Current user build : ${noOfBuildlists}" /> <echo message="Revision Build : ${revisionBuild}" /> <echo message="RC Build : ${rcBuild}" /> </target> </project>
我低于输出.
[echo] Current user build : 23 [echo] Revision Build : 8.40 [echo] RC Build : 0