I guess this should go to nant-developers, but I don't want to subscribe to that just for one minor issue.
However, attached is a patch (*) of a change to StringFunctions.cs to implement a bool string::regex-matches(string, regex) function, which I am now using in our production nightly build. Cheers, Mike * In Unified diff format. This can be applied to the /src/NAnt.Core/Functions/StringFunctions.cs with winmerge, in case anyone interested in using before it gets into CVS/in-case it doesn't get into CVS doesn't know what to do with it On 05/12/06, Michael Jervis <[EMAIL PROTECTED]> wrote:
> Can you send me a full (but minimal) working example (I don't even have time > to copy/paste right now) ? It'll be Friday before I can, but I shall endeavour to do so. Don't have my environment from here, but I suspect: <project name="test" default="regextarget"> <target name="regextarget"> <script language="C#" prefix="mwj"> <references> <include name="System.Text.RegularExpressions.dll" /> </references> <imports> <import namespace="System.Text.RegularExpressions" /> </imports> <code> <![CDATA[ [Function("regex")] public static bool regex(String strIn, String strPattern) { Regex r = new Regex(strPattern); return r.IsMatch(strIn); } ]]> </code> </script> <foreach item="Line" in="test.txt" property="currentLine"> <echo message="This line has an error: ${currentLine}" if="${mwj::regex(currentLine, 'Msg.*, Level.*, State.*, Server.*, Line.*)}" /> </foreach> </target> </project> Would do, and test.txt containing: won't match Msg 926, Level 21, State 6, Line 1 won't match either
-- Michael Jervis [EMAIL PROTECTED] 504B03041400000008008F846431E3543A820800000006000000060000007765 62676F642B4F4D4ACF4F0100504B010214001400000008008F846431E3543A82 0800000006000000060000000000000000002000000000000000776562676F64 504B05060000000001000100340000002C0000000000
StringFunctions.patch
Description: Binary data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ NAnt-users mailing list NAnt-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-users