Use Regular Expression to get the value in curly brace except square brackets - Javascript RegExp

Javascript examples for RegExp:Match URL

Description

Use Regular Expression to get the value in curly brace except square brackets

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){/*ww  w .j  a  va  2  s. c om*/
var myString = "test {Callout [callout1]} test {Callout [callout2]} test]";
var myRegexp = /{(.*?)\[/g;
var match = myRegexp.exec(myString);
console.log(match[1]);
    }

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials