Ant LineContains comma separated Value -
I have a property that has a string and now to change it from a comma to a separate list, test the lines in a file Want to do
Currently works the following with one value:
& lt; Loadfile property = "content" srcFile = "output.log" & gt; & Lt; Filterchain & gt; & Lt; Linecontains & gt; & Lt; Contains value = "$ {findvalue}" & gt; & Lt; / In & gt; & Lt; / Linecontains> & Lt; / Filterchain & gt; & Lt; / Loadfile & gt;
So if a file has a row:
Hello World!
and the value of findvalue = 'World' will find this line. Now we want to find all the rows that can match many words, so if there are lines of a file then
Hello World !
By all people!
We want to find the property = set = World, both the lines of each and the pickup file. I hope that I understand this, it is very hard to explain completely to me, any ideas about how to accomplish it best?
One way is the linecontainsregexp
filter matching a certain regular expression This trick to get lines, is to change the list of values separated by commas into a single Rex.
If the property is findvalue
the world, everyone
, regex bus the world | All are
, which means that either in the line, either World
or is
.
& lt; Property name = "searched" value = "world, everyone" /> & Lt; Loadresource property = "searchviewerx" & gt; & Lt; Propertyresource name = "findvalue" /> & Lt; Filterchain & gt; & Lt; Tokenfilter & gt; & Lt; Filetokenizer / & gt; & Lt; Replacestring = "," to = "|" / & Gt; & Lt; / Tokenfilter & gt; & Lt; / Filterchain & gt; & Lt; / Loadresource & gt; Then pass the property to this regex containing the linecontainsregexp
filter:
& Lt; / Linecontainsregexp & gt; & Lt; / Filterchain & gt; & Lt; / Loadfile & gt;
Comments
Post a Comment