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

Regex syntax #604

Open
danielnieto opened this issue Feb 10, 2025 · 1 comment
Open

Regex syntax #604

danielnieto opened this issue Feb 10, 2025 · 1 comment

Comments

@danielnieto
Copy link

I want to sanitize the input value, I made this work:

    js 
      const regex = /[^a-zA-Z0-9-]/g
      return {regex}
    end

    on input 
      set my value to my value.replace(regex, '')
    end

I was wondering how can I avoid having to define the regex in JS and put it directly in HS, I didn't find any reference on RegExp on the documentation

@danielnieto
Copy link
Author

danielnieto commented Feb 10, 2025

If I just use

    on input 
      set my value to my value.replace(/[^a-zA-Z0-9-]/g, '')
    end

I get this error:

Unexpected value: /

      set my value to my value.replace(/[^a-zA-Z0-9-]/g, '')
                                        ^^

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

No branches or pull requests

1 participant