Skip to content

Instantly share code, notes, and snippets.

@tokland
Last active March 31, 2022 23:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokland/6ff8c8782f3aac6914ed3c4b4a99fb9b to your computer and use it in GitHub Desktop.
Save tokland/6ff8c8782f3aac6914ed3c4b4a99fb9b to your computer and use it in GitHub Desktop.
Escape xpath string using concat
function escapeXpathString(str) {
const splitedQuotes = str.replace(/'/g, `', "'", '`);
return `concat('${splitedQuotes}', '')`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment