Javascript regular expression: \cX


<input type="button" value="Match" onclick="javascript:demo('aaa\u000Dhhh');return false;" />
&nbsp;&nbsp;&nbsp;
<input type="button" value="No Match" onclick="javascript:demo('aaahhh');return false;" />

<script type="text/javascript" language="JavaScript">
//<![CDATA[
   function demo(text) {
      var re = /\cM/;
      if (text.match(re)) {
         alert("match");
      } else {
         alert("no match");
      }
   }
//]]>
</script>


Note: Carriage return (=\u000D) is the same as ^M