<!DOCTYPE html>
<html ng-app="regexReverse">

  <head>
    <script data-require="angular.js@1.4.7" data-semver="1.4.7" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-controller="RegexCtrl">
    <h1>Regex Reverse</h1>
    <p>regex: <input class="mono" type="text" ng-model="regex" ng-trim="false"/></p>
    <p>reverse:
      <span class="mono">
        <span ng-if="reversed !== null">{{reversed}}</span>
        <span ng-if="reversed===null" style="color:red;">invalid</span>
      </span>
    </p>
    <p class="small">
      Note that there are many correct reversals for most inputs.
    </p>
  </body>

</html>
//obfuscated (not golfed, contains a lot of validation code) for the challenge; don't want to spoil anything
function reverse(e,r){function n(){t()
var r=e[v++]
if("\\"===r)return r+e[v++]
if("{"===r[0]){var n=e.indexOf("}",v-1)+1
i(-1!==n),r+=e.substring(v,n),i(/^\{[0-9]+(?:,(?:[0-9]+)?)?\}$/.test(r)),v=n}return r}function t(){i(v<e.length)}function i(e){if(!e)throw"invalid"}function f(e){if(e)throw"invalid"}if(!e)return""
for(var v=r||0,o=[];v<e.length;){var l=n()
if("|"==l||")"==l)break
if("["==l){var a
do l+=a=n()
while("]"!==a)
i(/^\[(?:(?:[^\-]|\\\-)(?:(?:[^\-]|\\\-)|\-(?:[^\-]|\\\-))*)?\]$/.test(l))}else if("("==l){for(var s=[];")"!==e[v-1];){t()
var u=reverse(e,v)
s.push(u[1]),v=u[0]}l="("+s.reverse().join("|")+")"}else if(-1!=="?+*{".indexOf(l[0])){i(o.length>0),o[o.length-1]+=l
continue}o.push(l)}var h=o.length-1,c=+(0===(r||0))
if(o.length){f("^"===o[0][0]&&o[0].length>1)
for(var g=c;g<o.length;g++)f("^"===o[g][0])
f("$"==o[h][0]&&o[h].length>1)
for(var g=0;g<o.length-c;g++)f("$"===o[g][0])}return[v,o.reverse().map(function(e){return"$"===e?"^":"^"===e?"$":e}).join("")]}function dorev(e){var r=/^(\^?)(.*?)(\$?)$/.exec(e||""),n=reverse(r[1]+"("+r[2]+")"+r[3])[1]
return n=n.replace("(",""),n=n.split("").reverse().join("").replace(")","").split("").reverse().join("")}

angular.module('regexReverse', [])
.controller('RegexCtrl', function($scope) {

$scope.$watch('regex',function(nv, ov) {
  console.log('"%s"',nv);
  $scope.reversed = null;
  try {
    $scope.reversed = dorev(nv);
  } catch(e) {
    console.log(e);
  }
})

$scope.reverse = function(input) {
  
  
};
});
body {
  font-family: sans-serif;
}

.mono {
  font-family: monospace;
}

.small {
  font-size: 12px;
  color: darkgrey;
}