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

[Feature Request] Regex support in move #15087

Open
zjma opened this issue Oct 25, 2024 · 0 comments
Open

[Feature Request] Regex support in move #15087

zjma opened this issue Oct 25, 2024 · 0 comments
Labels
compiler-v2 enhancement New feature or request move-framework Issues related to the Framework modules/libraries stale-exempt Prevents issues from being automatically marked and closed as stale

Comments

@zjma
Copy link
Contributor

zjma commented Oct 25, 2024

🚀 Feature Request

It would be great if allowed to do things like regex::match(b"^https://some.website/(?<user_id>\w+)$", b"https://some.website/user1") in move.

Motivation

It's supported in almost every programming language, by default :)

Pitch

A regex module with basic functionalities like below in aptos-stdlib would be good.

module regex {
  struct Match;
  struct Regex;
  public fun compile(pattern: vector<u8>): Regex;
  public fun match(regex: &Regex, s: vector<u8>): Match;
  public fun is_matched(match: &match): bool;
  public fun matched_group(match: &match, group_id: u64): vector<u8>;
}

better if implemented purely in Move.

Describe alternatives you've considered
Implementing in rust probably gives better performance, but can be complicated due to gas charging.
Advanced features like named group can come later in a v2.

Are you willing to open a pull request? (See CONTRIBUTING)
yes

Additional context

@zjma zjma added the enhancement New feature or request label Oct 25, 2024
@brmataptos brmataptos added the stale-exempt Prevents issues from being automatically marked and closed as stale label Oct 31, 2024
@brmataptos brmataptos moved this from 🆕 New to For Grabs in Move Language and Runtime Nov 14, 2024
@brmataptos brmataptos added move-framework Issues related to the Framework modules/libraries compiler-v2 labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-v2 enhancement New feature or request move-framework Issues related to the Framework modules/libraries stale-exempt Prevents issues from being automatically marked and closed as stale
Projects
Status: For Grabs
Development

No branches or pull requests

2 participants