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

match() function needs double backslash in the regex #1746

Open
1 task done
martkaczmarek opened this issue Mar 29, 2024 · 1 comment
Open
1 task done

match() function needs double backslash in the regex #1746

martkaczmarek opened this issue Mar 29, 2024 · 1 comment
Labels
backend Backend server changes (GO)
Milestone

Comments

@martkaczmarek
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Version of Corteza

2023.9.4

Current Behavior

When using match() function in field validation, the regex definition containing backslashes must have these backslashed doubled to work.
For example, a single regex that should return true on digits:
^\d+$
throws an error:
image
if I define the digits in another way, it works fine:
^[0-9]+$
Adding a second backslash to the original regex seems to fix it:
^\\d+$

Expected Behavior

match() function should accept raw regex expression, without the need to double-escape special characters.

Steps To Reproduce

  1. Create a text field
  2. Add the following validation step:
    match(value, "^\d+$")

Environment and versions

No response

Anything else?

No response

@Fajfa Fajfa added the backend Backend server changes (GO) label Apr 15, 2024
@Fajfa Fajfa added this to the 2024.3.x milestone Apr 15, 2024
@lennyhorstink2
Copy link

Someone else has this regex:

match(value,"\b([A-ZÀ-ÿ][-,a-z. '_]+[ ()]*)+")

https://regexr.com/7ucc2

I tried to add a double backslash, but to no avail. match(value, "^\d+$") works, but match(value,"\b([A-ZÀ-ÿ][-,a-z. '_]+[ ()]*)+") not.

Maybe there are more characters that are problematic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend server changes (GO)
Projects
None yet
Development

No branches or pull requests

3 participants