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

[Bug]: Runtime error for Unicode escape values in regex #40299

Closed
SasinduDilshara opened this issue Apr 25, 2023 · 1 comment · Fixed by #40368
Closed

[Bug]: Runtime error for Unicode escape values in regex #40299

SasinduDilshara opened this issue Apr 25, 2023 · 1 comment · Fixed by #40368
Assignees
Labels
Lang/Regexp Issues related to Ballerina regular expressions Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug

Comments

@SasinduDilshara
Copy link
Contributor

Description

Following Code

import ballerina/io;

public function main() {
    string:RegExp r = re `\u{1F600}`;
    io:println(r.replaceAll("😀 Hello, 🌍! ❤️", ""));
}

Gives

error: {ballerina}RegularExpressionParsingError {"message":"invalid regexp pattern: Illegal Unicode escape sequence near index 2
\u{1F600}
  ^"}
        at ballerina.lang.regexp.0:findAllGroupsImpl(regexp.bal:190)
           ballerina.lang.regexp.0:findAllGroups(regexp.bal:164)
           ballerina.lang.regexp.0:replaceAll(regexp.bal:377)

This runtime error also happen in

import ballerina/io;

public function main() {
    string:RegExp r = re `[\u{1F600}-\u{1F6FF}]`;
    io:println(r.replaceAll("😀 Hello, 🌍! ❤️", ""));
}

Steps to Reproduce

No response

Affected Version(s)

No response

OS, DB, other environment details and versions

No response

Related area

-> Runtime

Related issue(s) (optional)

No response

Suggested label(s) (optional)

No response

Suggested assignee(s) (optional)

No response

@SasinduDilshara SasinduDilshara added Type/Bug Lang/Regexp Issues related to Ballerina regular expressions Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. labels Apr 25, 2023
@ballerina-bot ballerina-bot added the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label Apr 25, 2023
@warunalakshitha warunalakshitha removed the Team/jBallerina All the issues related to BIR, JVM backend code generation and runtime label Apr 27, 2023
@github-actions
Copy link

This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now.

      - Reason/EngineeringMistake - The issue occurred due to a mistake made in the past.
      - Reason/Regression - The issue has introduced a regression.
      - Reason/MultipleComponentInteraction - Issue occured due to interactions in multiple components.
      - Reason/Complex - Issue occurred due to complex scenario.
      - Reason/Invalid - Issue is invalid.
      - Reason/Other - None of the above cases.

@pcnfernando pcnfernando added the Reason/EngineeringMistake The issue occurred due to a mistake made in the past. label May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang/Regexp Issues related to Ballerina regular expressions Priority/High Reason/EngineeringMistake The issue occurred due to a mistake made in the past. Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times. Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants