A little helper function:
export function escapeRegExp(str: string) {
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
<!doctype html> | |
<html> | |
<head> | |
<script src="test.js"></script> | |
</head> | |
<body> | |
<div id="test"></div> | |
</body> | |
</html> |