function tokenize(text) {
  const rawTokens = text.split(/[\s\/]+/mg);
  const tokens = [];
  rawTokens.forEach(token => {
    // Strip off unwanted trivial characters
    token = token
        .trim()
        .replace(/^[_\-"'`({[<$*)}\]>.]+/, '')
        .replace(/[_\-"'`({[<$*)}\]>.]+$/, '');
    // Ignore tokens that contain weird characters
    if (/^[\w.\-]+$/.test(token)) {
      tokens.push(token.toLowerCase());
      const ngTokenMatch = /^[nN]g([A-Z]\w*)/.exec(token);
      if (ngTokenMatch) {
        tokens.push(ngTokenMatch[1].toLowerCase());
      }
    }
  });
  return tokens;
}
function tokenize(text) {
  const rawTokens = text.split(/[\s\/]+/mg);
  const tokens = [];
  rawTokens.forEach(token => {
    // Strip off unwanted trivial characters
    token = token
        .trim()
        .replace(/^[_\-"'`({[<$*)}\]>.]+/, '')
        .replace(/[_\-"'`({[<$*)}\]>.]+$/, '');
    // Ignore tokens that contain weird characters
    if (/^[\w.\-]+$/.test(token)) {
      tokens.push(token.toLowerCase());
      const ngTokenMatch = /^[nN]g([A-Z]\w*)/.exec(token);
      if (ngTokenMatch) {
        tokens.push(ngTokenMatch[1].toLowerCase());
      }
    }
  });
  return tokens;
}
function tokenize ( text ) { const rawTokens = text . split ( / [\s\/]+ / mg ) ; const tokens = [ ] ; rawTokens . forEach ( token => { // Strip off unwanted trivial characters token = token . trim ( ) . replace ( / ^[_\-"'`({[<$*)}\]>.]+ / , '' ) . replace ( / [_\-"'`({[<$*)}\]>.]+$ / , '' ) ; // Ignore tokens that contain weird characters if ( / ^[\w.\-]+$ / . test ( token ) ) { tokens . push ( token . toLowerCase ( ) ) ; const ngTokenMatch = / ^[nN]g([A-Z]\w*) / . exec ( token ) ; if ( ngTokenMatch ) { tokens . push ( ngTokenMatch [ 1 ] . toLowerCase ( ) ) ; } } } ) ; return tokens ; }
If the heading contains a name starting with ng, e.g. "ngController", then add the name without the ng to the text, e.g. "controller".
If the heading contains a name starting with ng e . g . ngController then add the name without the ng to the text e . g . controller .
Split text into tokens