I am looking to have a regex for passing a value in the array to comma separated. Here is the regex I used for the fetching the value.
Regex: id="selectedAgency(.+?)" currently using this regex I am able to find the below value which is matching in id="selectedAgency[1]"
Hence the outcome I receives is as follows:
&selectedAgencies=[14],[12],[10],[9]
However I would like to have the actual output as the below:
&selectedAgencies= 14,12,10,9
not sure if this JavaScript version works for you but here it is. Hopefully the regex and replace part should help.
let str = "&selectedAgencies=[14],[12],[10],[9]";
let result = str.replace(/\[(\d+)\]/g, "$1"); //&selectedAgencies=14,12,10,9
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.