getKeywords method #109

Open
nijikokun opened this Issue Mar 12, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@nijikokun
Rainbow.getKeywords = function(str) {
  str = str.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|');
  return '\\b(?:' + str + ')\\b';
};

Would be nice to have in the official file for things like:

Rainbow.getKeywords('break case catch class copy const __finally __exception __try');

would return

"\b(?:break|case|catch|class|copy|const|__finally|__exception|__try)\b"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment