Javascript String hexNumber()

Description

Javascript String hexNumber()


// http://www.codewars.com/kata/regexp-basics-is-it-a-hexadecimal-number

String.prototype.hexNumber = function() {
  return /^(0x)?[A-Fa-f0-9]+(?!\n)$/.test(this) && !/\n/.test(this);
};

Javascript String hexNumber()

String.prototype.hexNumber = function() {
 return /^(0x)?[0-9a-f]*$/i.test(this);
};



PreviousNext

Related