Use regex to check string ends - Node.js Regular expression

Node.js examples for Regular expression:Match

Description

Use regex to check string ends

Demo Code

String.prototype.endsWith = function(str) {
  return (this.match(str + "$") == str);
}

Related Tutorials