mirror of
https://github.com/discourse/discourse.git
synced 2025-02-19 21:18:46 +08:00

This was re-implemented in a number of places - it makes more sense as a utility function.
4 lines
142 B
JavaScript
4 lines
142 B
JavaScript
export default function escapeRegExp(string) {
|
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
}
|