How to retrieve value of id from the square bracket correctly

I have the following code and I’ve got the id and name value in its own square bracket as shown below. How can I access the value of id and name?

You are getting the id and name but they are in arrays. Use this so id and name become string variables:

let id = data.match(/(?<=id=)\d+(?=\,)/g)[0];
let name = data.match(/(?<=name=)[\w|-]*/g)[0];

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.