Javascript examples for RegExp:Match URL
Use Regular Expression to get the value in curly brace except square brackets
<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>