Nodejs Utililty Methods String Scan

List of utility methods to do String Scan

Description

The list of methods to do String Scan are organized into topic(s).

Method

scan(pattern)
String.prototype.scan = function(pattern){
  if (Object.isString(pattern))
    pattern = RegExp.escape(pattern);
  return this.match(pattern);
};
scan(pattern, iterator)
String.prototype.scan = function(pattern, iterator) {
  this.gsub(pattern, iterator);
  return String(this);
};
scan(re)
String.prototype.scan = function (re) {
    if (!re.global) throw "RegExp should be global";
    var s = this;
    var m, r = [];
    while (m = re.exec(s)) {
        m.shift();
        r.push(m);
    return r;
...
scan(regex)
String.prototype.scan = function (regex) {
  if (!regex.global) throw "Scan Error";
  var self = this;
  var match, occurrences = [];
  while (match = regex.exec(self)) {
    match.shift();
    occurrences.push(match[0]);
  return occurrences;
...