.DS_Store
# regex-in-javascript
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Javascript Regular Expressions: Match the Start and End of a Line</title>
  <style>
    pre {
      line-height: 2;
    }
    span {
      background-color: #eee;
      padding: 1px;
      outline: 1px solid #999;
    }
  </style>
</head>
<body>
  <script>
    // Allows Plunker to display logs in preview panel 
    // for better in-browser experience
    var originalConsoleLog = console.log
    console.log = function () {
      originalConsoleLog.apply(console, arguments)
      var args = Array.prototype.slice.call(arguments);
      var stringifiedArgs = args.join(' ') + '\n';
      var newDiv = document.createElement("div"); 
      var newContent = document.createTextNode(stringifiedArgs); 
      newDiv.appendChild(newContent);
      document.body.appendChild(newDiv)
      
      document.querySelector('div').style['fontFamily'] = 'monospace';
      document.querySelector('div').style['fontSize'] = '1.5em';
    };
  </script>
  
  <pre></pre>
  <script src="script.js"></script>
</body>
</html>
'use strict';

var str = `12/1/16
12-16-13
11/12/16
12-12-2016`;
var regex = /^12.+16$/gm;

// console.log(regex.exec(str))

/**
 * @param  String str
 * @param  RegExp regex
 * @param  HTMLElement target
 */
const output = (str, regex, target) => {
  target.innerHTML =
    str.replace(regex, str =>
      `<span>${str}</span>`
    );
}
output(str, regex, document.querySelector('pre'));