From 7528d0bf47a4e6e81ea23b0463089ff608bdf660 Mon Sep 17 00:00:00 2001 From: Wade Klingler Date: Wed, 20 Jul 2016 15:49:53 -0600 Subject: [PATCH 1/2] Implemented Regex.IsMatch(string, string) --- .../Text/Classes/System.Text.RegularExpressions.Regex.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js b/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js index a509bce82..06a274682 100644 --- a/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js +++ b/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js @@ -119,6 +119,15 @@ JSIL.ImplementExternals("System.Text.RegularExpressions.Regex", function ($) { return (matchCount > 0); } ); + + $.Method({ Static: true, Public: true }, "IsMatch", + (new JSIL.MethodSignature($.Boolean, [$.String, $.String], [])), + function IsMatch(input, pattern) { + var re = makeRegex(pattern, System.Text.RegularExpressions.RegexOptions.ECMAScript); + + return re.test(input); + } + ); }); JSIL.MakeClass($jsilcore.TypeRef("System.Object"), "System.Text.RegularExpressions.Regex", true, [], function ($) { From a3294b5aa8799d3e95b1b29f6f1a25e8436f0f9d Mon Sep 17 00:00:00 2001 From: Wade Klingler Date: Thu, 21 Jul 2016 10:53:47 -0600 Subject: [PATCH 2/2] This one returns all same results that are found on msdn (https://msdn.microsoft.com/en-us/library/sdx2bds0(v=vs.110).aspx) --- .../Text/Classes/System.Text.RegularExpressions.Regex.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js b/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js index 06a274682..ec17155de 100644 --- a/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js +++ b/JSIL.Libraries/Includes/Bootstrap/Text/Classes/System.Text.RegularExpressions.Regex.js @@ -124,8 +124,13 @@ JSIL.ImplementExternals("System.Text.RegularExpressions.Regex", function ($) { (new JSIL.MethodSignature($.Boolean, [$.String, $.String], [])), function IsMatch(input, pattern) { var re = makeRegex(pattern, System.Text.RegularExpressions.RegexOptions.ECMAScript); - - return re.test(input); + var matchCount = 0; + var current = null; + while ((current = re.exec(input)) !== null) { + matchCount += 1; + } + + return (matchCount > 0); } ); });