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

[Combobox] - Value needs to be escaped before sending to Regex #11481

Closed
faridmovsumov opened this issue Jan 19, 2024 · 1 comment
Closed

[Combobox] - Value needs to be escaped before sending to Regex #11481

faridmovsumov opened this issue Jan 19, 2024 · 1 comment

Comments

@faridmovsumov
Copy link

There is a problem with the example code provided for Combobox. Value needs to be escaped before being used in Regex

image

If one of the following chars can be used in value string to reproduce the problem "\" "*"

The following function needs to be used before sending value to regex

const escapeRegExp = (string) => {
        return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}

How example should be

image

Copy link
Contributor

Hi! We noticed there hasn’t been activity on this issue in a while. After 30 days, it will close automatically.

If it’s still relevant, or you have updates, comment and let us know. And don’t worry, you can always re-open later if needed.

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

No branches or pull requests

1 participant