mirror of
https://github.com/discourse/discourse.git
synced 2024-12-04 06:13:43 +08:00
4 lines
142 B
JavaScript
4 lines
142 B
JavaScript
|
export default function escapeRegExp(string) {
|
||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
||
|
}
|