Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gregli-msft committed Mar 29, 2024
2 parents 8652fb1 + 3a48cf2 commit 0873115
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,7 @@ public Task<FormulaValue> InvokeAsync(FormulaValue[] args, CancellationToken can
string regularExpression = sv1.Value;
string matchOptions = args.Length == 3 ? ((StringValue)args[2]).Value : RegexOptions;

RegexOptions regOptions = System.Text.RegularExpressions.RegexOptions.CultureInvariant;

if (!matchOptions.Contains("c"))
{
return Task.FromResult<FormulaValue>(FormulaValue.New(false));
}
RegexOptions regOptions = System.Text.RegularExpressions.RegexOptions.CultureInvariant;

if (matchOptions.Contains("i"))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Error({Kind:ErrorKind.BadRegex})
Error({Kind:ErrorKind.Timeout})

>> IsMatch("Hi", "Hi", "foo")
false
true

>> IsMatch("28", 28)
Errors: Error 14-16: Regular expressions must be constant values.
Expand All @@ -142,3 +142,12 @@ true

>> IsMatch("Hello 123 world", $"Hello {Sqrt(1)}{Sqrt(4)}{Sqrt(9)} world")
true

>> IsMatch("Hello", "Hello", MatchOptions.IgnoreCase)
true

>> IsMatch("Hello", "Hello", "")
true

>> IsMatch("Hi", "Hi", MatchOptions.Multiline)
true
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ Errors: Error 15-30: Regular expressions must be constant values.|Error 0-31: Th
>> Match("(555) 123-4567", "^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$")
{FullMatch:"(555) 123-4567",StartMatch:1,SubMatches:Table()}

>> Match("Hello", "Hello", MatchOptions.IgnoreCase)
{FullMatch:"Hello",StartMatch:1,SubMatches:Table()}

>> Match("Hello", "Hello", "")
{FullMatch:"Hello",StartMatch:1,SubMatches:Table()}

>> Match("Hi", "Hi", MatchOptions.Multiline)
{FullMatch:"Hi",StartMatch:1,SubMatches:Table()}

Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ Errors: Error 18-25: Regular expressions must be constant values.|Error 0-26: Th

>> MatchAll(1/0, "Hi")
Error({Kind:ErrorKind.Div0})

>> MatchAll("Hello", "Hello", MatchOptions.IgnoreCase)
Table({FullMatch:"Hello",StartMatch:1,SubMatches:Table()})

>> MatchAll("Hello", "Hello", "")
Table({FullMatch:"Hello",StartMatch:1,SubMatches:Table()})

>> MatchAll("Hi", "Hi", MatchOptions.Multiline)
Table({FullMatch:"Hi",StartMatch:1,SubMatches:Table()})

0 comments on commit 0873115

Please sign in to comment.