Javascript examples for RegExp:Bracket
Regex for capturing variables in curved brackets
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* www .j ava 2 s . c om*/ var str = "heres:a:func('var1', 'var2', 'var3', 2)" var args = /\(\s*([^)]+?)\s*\)/.exec(str); if (args[1]) { args = args[1].split(/\s*,\s*/); } console.log(args); } </script> </head> <body> </body> </html>