Skip to content

Instantly share code, notes, and snippets.

@hwindo
Last active June 6, 2018 07:07
Show Gist options
  • Save hwindo/a4eb68d86157dd93301bd0e4aa9a77d8 to your computer and use it in GitHub Desktop.
Save hwindo/a4eb68d86157dd93301bd0e4aa9a77d8 to your computer and use it in GitHub Desktop.
simple js function to check if a string is XML using Regular Expression
function checkStringIsXML(data) {
var matcher = new RegExp('<?xml');
return data.match(matcher) ? true : false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment