Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
gregli-msft committed Mar 7, 2025
1 parent 592c57f commit 98e67e0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/libraries/Microsoft.PowerFx.Core/Types/Enums/BuiltInEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ internal static class BuiltInEnums
DType.String,
new Dictionary<string, object>()
{
{ "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);

Expand Down
16 changes: 8 additions & 8 deletions src/strings/PowerFxResources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -4521,7 +4521,7 @@
</data>
<data name="ErrorResource_ErrInvalidRegExBadInlineOptions_ShortMessage" xml:space="preserve">
<value>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}".</value>
<comment>Error message indicating that the regular expression has bad inline options.</comment>
<comment>{Locked=[imnsx]}Error message indicating that the regular expression has bad inline options.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExBadOctal_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Octal \0 character codes are not supported, use hexadecimal \x or Unicode \u instead, found "{0}".</value>
Expand Down Expand Up @@ -4561,19 +4561,19 @@
</data>
<data name="ErrorResource_ErrInvalidRegExUnclosedInlineComment_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Unclosed inline comment, starts with "(?#...".</value>
<comment>Error message indicating that the regular expression includes an unclosed inline comment.</comment>
<comment>{Locked=(?#...} Error message indicating that the regular expression includes an unclosed inline comment.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExInlineOptionConflictsWithNumberedSubMatches_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Inline option is incompatible with MatchOptions.NumberedSubMatches, found "{0}".</value>
<comment>Error message indicating that the regular expression includes an inline option that is incompatible with numbered sub matches.</comment>
<comment>{Locked=MatchOptions.NumberedSubMatches} Error message indicating that the regular expression includes an inline option that is incompatible with numbered sub matches.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExBadQuantifier_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Possessive quantifiers are not supported, found "{0}".</value>
<comment>Error message indicating that the regular expression does not support possessive quantifiers.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExBadExactQuantifier_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Exact quantifiers cannot be used with quantifier modifiers such as ? for lazy, found "{0}".</value>
<comment>Error message indicating that the regular expression does not support modifiers for exact quantifiers.</comment>
<comment>{Locked=?}Error message indicating that the regular expression does not support modifiers for exact quantifiers.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExBadEscape_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Invalid escape code, found "{0}".</value>
Expand Down Expand Up @@ -4641,23 +4641,23 @@
</data>
<data name="ErrorResource_ErrInvalidRegExBadSingleQuoteNamedCapture_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Using single quoted named captures is not supported, use (?&lt;...&gt;) syntax instead, found "{0}".</value>
<comment>Error message indicating that the regular expression has single quoted named capture.</comment>
<comment>{Locked=(?&lt;...&gt;)} Error message indicating that the regular expression has single quoted named capture.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExBadConditional_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Conditional alternation is not supported, found "{0}".</value>
<comment>Error message indicating that the regular expression has conditionals.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExMixingNamedAndNumberedSubMatches_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Named captures cannot be used with MatchOptions.NumberedSubMatches enabled, found "{0}".</value>
<comment>Error message indicating that the regular expression is mixing named and numbered captures.</comment>
<comment>{Locked=MatchOptions.NumberedSubMatches}Error message indicating that the regular expression is mixing named and numbered captures.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExNumberedSubMatchesDisabled_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Use named captures with "(?&lt;name&gt;...)" and "\k&lt;name&gt;" or enable MatchOptions.NumberedSubMatches, found "{0}".</value>
<comment>Error message indicating that the regular expression is not enabled for numbered captures.</comment>
<comment>{Locked=(?&lt;name&gt;...)}{Locked=\k&lt;name&gt;} Error message indicating that the regular expression is not enabled for numbered captures.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExLiteralHyphenInCharacterClass_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Literal hyphen in character class must be escaped with backslash, escape with "\-", found in "{0}".</value>
<comment>Error message indicating that the regular expression has a hyphen in a character class.</comment>
<comment>{Locked=\-}Error message indicating that the regular expression has a hyphen in a character class.</comment>
</data>
<data name="ErrorResource_ErrInvalidRegExUnescapedCharInCharacterClass_ShortMessage" xml:space="preserve">
<value>Invalid regular expression: Literal character needs to be escaped with a backslash when used in a character class, found at the end of "{0}".</value>
Expand Down

0 comments on commit 98e67e0

Please sign in to comment.