I have the following code, but getting no output. When I run it here it seems to work:
var strng = '[,][123,1][,][456,2][,][789,3][,][,][,][,][,][,][,][,]'; var rgx = [(.[0-9,]+)]; var outstr = strng.match(rgx).join(','); Write(outstr);
To clarify, I aim to capture all the values between the brackets if they contain a number (including the opening and closing bracket of that group)
Guess I am doing something wrong somewhere?
Try this one instead:
It matches a substring if it contains:
- an opening bracket
- an integer
- a comma
- another integer
- a closing bracket
… in that order, without any whitespace.
Also note that a regexp literal starts with
/. The way you’ve defined
var rgx in your snippet is a SyntaxError