diff --git a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Match.cs b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Match.cs index f7b90a034d..a14996e5fc 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Match.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/Match.cs @@ -63,7 +63,7 @@ public MatchAllFunction(RegexTypeCache regexTypeCache) // These start with the codes that can come after a regular expression definition in Perl/JavaScript with "/a+/misx" and can also be used in "(?misx)a+". // If possible, do not add lower case letters that are Power Fx specific to avoid future conflicts with the industry. We added ^, $, and N as Power Fx specific. - public class MatchOptionCodes + internal class MatchOptionCodes { public const char BeginsWith = '^'; // invented by us, adds a '^' at the front of the regex public const char EndsWith = '$'; // invented by us, adds a '$' at the end of the regex diff --git a/src/libraries/Microsoft.PowerFx.Core/Types/Enums/BuiltInEnums.cs b/src/libraries/Microsoft.PowerFx.Core/Types/Enums/BuiltInEnums.cs index 9321814c11..af1098ba2c 100644 --- a/src/libraries/Microsoft.PowerFx.Core/Types/Enums/BuiltInEnums.cs +++ b/src/libraries/Microsoft.PowerFx.Core/Types/Enums/BuiltInEnums.cs @@ -81,15 +81,15 @@ internal static class BuiltInEnums DType.String, new Dictionary() { - { "BeginsWith", MatchOptionCodes.BeginsWith + MatchOptionCodes.Contains }, - { "EndsWith", MatchOptionCodes.Contains + MatchOptionCodes.EndsWith }, - { "Complete", MatchOptionCodes.BeginsWith + MatchOptionCodes.Contains + MatchOptionCodes.EndsWith }, - { "Contains", MatchOptionCodes.Contains }, - { "IgnoreCase", MatchOptionCodes.IgnoreCase }, - { "Multiline", MatchOptionCodes.Multiline }, - { "FreeSpacing", MatchOptionCodes.FreeSpacing }, - { "DotAll", MatchOptionCodes.DotAll }, - { "NumberedSubMatches", MatchOptionCodes.NumberedSubMatches } + { "BeginsWith", $"{MatchOptionCodes.BeginsWith}{MatchOptionCodes.Contains}" }, + { "EndsWith", $"{MatchOptionCodes.Contains}{MatchOptionCodes.EndsWith}" }, + { "Complete", $"{MatchOptionCodes.BeginsWith}{MatchOptionCodes.Contains}{MatchOptionCodes.EndsWith}" }, + { "Contains", $"{MatchOptionCodes.Contains}" }, + { "IgnoreCase", $"{MatchOptionCodes.IgnoreCase}" }, + { "Multiline", $"{MatchOptionCodes.Multiline}" }, + { "FreeSpacing", $"{MatchOptionCodes.FreeSpacing}" }, + { "DotAll", $"{MatchOptionCodes.DotAll}" }, + { "NumberedSubMatches", $"{MatchOptionCodes.NumberedSubMatches}" } }, canConcatenateStronglyTyped: true); diff --git a/src/strings/PowerFxResources.en-US.resx b/src/strings/PowerFxResources.en-US.resx index 32cf3ade10..0ca17ee86e 100644 --- a/src/strings/PowerFxResources.en-US.resx +++ b/src/strings/PowerFxResources.en-US.resx @@ -4521,7 +4521,7 @@ Invalid regular expression: Inline options are limited to a combination of the letters [imnsx], cannot disable options, and cannot be used on a subexpression, found "{0}". - Error message indicating that the regular expression has bad inline options. + {Locked=[imnsx]}Error message indicating that the regular expression has bad inline options. Invalid regular expression: Octal \0 character codes are not supported, use hexadecimal \x or Unicode \u instead, found "{0}". @@ -4561,11 +4561,11 @@ Invalid regular expression: Unclosed inline comment, starts with "(?#...". - Error message indicating that the regular expression includes an unclosed inline comment. + {Locked=(?#...} Error message indicating that the regular expression includes an unclosed inline comment. Invalid regular expression: Inline option is incompatible with MatchOptions.NumberedSubMatches, found "{0}". - Error message indicating that the regular expression includes an inline option that is incompatible with numbered sub matches. + {Locked=MatchOptions.NumberedSubMatches} Error message indicating that the regular expression includes an inline option that is incompatible with numbered sub matches. Invalid regular expression: Possessive quantifiers are not supported, found "{0}". @@ -4573,7 +4573,7 @@ Invalid regular expression: Exact quantifiers cannot be used with quantifier modifiers such as ? for lazy, found "{0}". - Error message indicating that the regular expression does not support modifiers for exact quantifiers. + {Locked=?}Error message indicating that the regular expression does not support modifiers for exact quantifiers. Invalid regular expression: Invalid escape code, found "{0}". @@ -4641,7 +4641,7 @@ Invalid regular expression: Using single quoted named captures is not supported, use (?<...>) syntax instead, found "{0}". - Error message indicating that the regular expression has single quoted named capture. + {Locked=(?<...>)} Error message indicating that the regular expression has single quoted named capture. Invalid regular expression: Conditional alternation is not supported, found "{0}". @@ -4649,15 +4649,15 @@ Invalid regular expression: Named captures cannot be used with MatchOptions.NumberedSubMatches enabled, found "{0}". - Error message indicating that the regular expression is mixing named and numbered captures. + {Locked=MatchOptions.NumberedSubMatches}Error message indicating that the regular expression is mixing named and numbered captures. Invalid regular expression: Use named captures with "(?<name>...)" and "\k<name>" or enable MatchOptions.NumberedSubMatches, found "{0}". - Error message indicating that the regular expression is not enabled for numbered captures. + {Locked=(?<name>...)}{Locked=\k<name>} Error message indicating that the regular expression is not enabled for numbered captures. Invalid regular expression: Literal hyphen in character class must be escaped with backslash, escape with "\-", found in "{0}". - Error message indicating that the regular expression has a hyphen in a character class. + {Locked=\-}Error message indicating that the regular expression has a hyphen in a character class. Invalid regular expression: Literal character needs to be escaped with a backslash when used in a character class, found at the end of "{0}".