Skip to content

Instantly share code, notes, and snippets.

@internetsadboy
Created February 9, 2015 01:51
Show Gist options
  • Save internetsadboy/0cbc05ac56a8bc317898 to your computer and use it in GitHub Desktop.
Save internetsadboy/0cbc05ac56a8bc317898 to your computer and use it in GitHub Desktop.
qm-regex
/**
* @param {String} str
* @return {Boolean}
*/
function hasQuestionMark (str) {
return /\?/g.test(str);
}
/**
* @param {String} str
* @return {String}
*/
function setQuestionMark (str) {
return str.replace(/\?{2,}/g, '?');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment