Bugs item #1183112, was opened at 2005-04-14 23:05 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1183112&group_id=31650
Category: Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Henry (henryl) Assigned to: Nobody/Anonymous (nobody) Summary: Regex doesn't fail when match fails Initial Comment: The regex task doesn't fail when the regex doesn't match correctly. This was because it was testing for no groups in the match result object, instead of testing against Match.Empty (as Match.Empty does actually have one group). --- ..\..\..\..\latest\nant-0.85-nightly-2005-03-31\src\NAnt.Core\Tasks\RegexTask.cs 2004-09-07 19:17:48.000000000 +0100 +++ RegexTask.cs 2005-04-14 15:42:42.596390600 +0100 @@ -156,7 +156,7 @@ Match match = regex.Match(Input); - if (match.Groups.Count == 0) { + if (match == Match.Empty) { throw new BuildException(string.Format(CultureInfo.InvariantCulture, "No match found for expression '{0}' in '{1}'.", Pattern, Input), Location); --- ..\..\..\..\latest\nant-0.85-nightly-2005-03-31\tests\NAnt.Core\Tasks\RegexT askTest.cs 2004-12-27 05:11:18.000000000 +0000 +++ RegexTaskTest.cs 2005-04-14 15:58:02.392042000 +0100 @@ -56,7 +56,8 @@ <regex pattern=""(?'digit'\d)$"" input='This is a testsentence' /> <echo message='${digit}'/> </project>"; - RunBuild(_xml); + string result = RunBuild(_xml); + Assertion.Assert("Regex did not report a non match.\n" + result, result.IndexOf(@"No match found for expression") != -1); } } } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=402868&aid=1183112&group_id=31650 ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ nant-developers mailing list nant-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nant-developers