mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
FilterInput escapes all input strings for special characters that might be used in a RegExp by calling escapeStringForRegex, and using unEscapeStringFromRegex for display. Both of these functions used string.prototype.replace() for escaping. replace() only replaces the first occurence of a search string unless called with a global RegExp. The output of these functions was not necessarily safe to compile into a RegExp literal. This change creates RegExps for escapeStringForRegex and unEscapeStringFromRegex to match all occurrences of the special characters instead of just their first occurrence. This makes a variety of strings safe for RegExp compilation.
Grafana Data Library
@grafana/data is currently in BETA.
This package holds the root data types and functions used within Grafana.