Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limited regular expressions #2504

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

Limited regular expressions #2504

wants to merge 28 commits into from

Conversation

gregli-msft
Copy link
Contributor

@gregli-msft gregli-msft commented Jun 25, 2024

Before we GA regular expressions in C# we'd like to have one consistent regular expression language between C# and Canvas. This PR limits regular expressions to common features that are supported, with consistent semantics, by both canonical .NET (used by the C# interpreter) and XRegExp (used by Canvas/JavaScript). It is better to disallow now and bring back with customer demand or as platforms add more support.

.NET Features that are disallowed:

  • Capture groups
    • Self-referncing groups, such as (a\1).
    • Treat all escaped number sequences as a backreference number.
    • Single quoted (?'name'... and \k'name'.
    • Balancing capture groups.
  • Octal character codes (use Hex or Unicode instead).
    • \o (letter o) could be added in the future, but we should avoid \0 (zero) which causes backreference confusion.
  • Inline options
    • Anywhere in the expression except the beginning.
    • For subexpressions.
  • Character classes
    • Character class subtraction [a-z-[m-n]].
  • Conditional alternation

@MikeStall
Copy link
Contributor

This looks good to me. My top concern is complexity - but this keeps it simple.

@gregli-msft gregli-msft marked this pull request as ready for review July 3, 2024 06:28
@gregli-msft gregli-msft requested a review from a team as a code owner July 3, 2024 06:28
@CarlosFigueiraMSFT
Copy link
Contributor

Do all positive tests under Match_Limited.txt work in Power Apps?

@@ -153,12 +153,12 @@ private static bool ShouldSkipDotNetVersion(ExpressionTestCase testCase, string
return false;
}

#if false
#if true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to revert this back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants