This is my input:
$.drawPlots({"times":[1578009600,1578096000,1578182400,1578268800,1578355200,1578441600,1578528000,1578614400,1578700800,1578787200,1578873600,1578960000,1579046400,1579132800,1579219200,1579305600,1579392000,1579478400,1579564800,1579651200,1579737600],"plots":{"assigned":[9,0,0,24,17,21,17,23,0,0,28,20,32,19,12,0,0,15,25,36,19],"closed":[15,0,0,34,46,37,38,70,0,0,42,21,67,48,54,0,0,41,38,55,19],"created":[21,2,2,38,28,33,39,62,2,1,43,27,36,53,33,1,1,44,41,58,20],"deleted":[4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"edited":[3,0,0,43,207,2,4,0,0,0,0,2,1,1,2,0,0,0,2,3,0],"overdue":[0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0],"reopened":[0,0,0,4,6,4,2,3,0,0,3,5,4,3,4,0,0,5,2,2,5]},"events":["assigned","closed","created","deleted","edited","overdue","reopened"]});
// Set Selected Period For Dashboard Stats and Export
And I want to return
{"times":[1578009600,1578096000,1578182400,1578268800,1578355200,1578441600,1578528000,1578614400,1578700800,1578787200,1578873600,1578960000,1579046400,1579132800,1579219200,1579305600,1579392000,1579478400,1579564800,1579651200,1579737600],"plots":{"assigned":[9,0,0,24,17,21,17,23,0,0,28,20,32,19,12,0,0,15,25,36,19],"closed":[15,0,0,34,46,37,38,70,0,0,42,21,67,48,54,0,0,41,38,55,19],"created":[21,2,2,38,28,33,39,62,2,1,43,27,36,53,33,1,1,44,41,58,20],"deleted":[4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"edited":[3,0,0,43,207,2,4,0,0,0,0,2,1,1,2,0,0,0,2,3,0],"overdue":[0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0],"reopened":[0,0,0,4,6,4,2,3,0,0,3,5,4,3,4,0,0,5,2,2,5]},"events":["assigned","closed","created","deleted","edited","overdue","reopened"]}
One of my attempts ended up like this:
d,r,a,w,P,l,o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7,,,2,,,4,,,0,,,0,,,0,,,0,,,2,,,1,,,1,,,2,,,0,,,0,,,0,,,2,,,3,,,0,],,,o,v,e,r,d,u,e,[,0,,,0,,,0,,,0,,,0,,,1,,,1,,,0,,,0,,,0,,,0,,,0,,,0,,,0,,,0,,,0,,,0,,,1,,,0,,,0,,,0,],,,r,e,o,p,e,n,e,d,[,0,,,0,,,0,,,4,,,6,,,4,,,2,,,3,,,0,,,0,,,3,,,5,,,4,,,3,,,4,,,0,,,0,,,5,,,2,,,2,,,5,],},,,e,v,e,n,t,s,[,a,s,s,i,g,n,e,d,,,c,l,o,s,e,d,,,c,r,e,a,t,e,d,,,d,e,l,e,t,e,d,,,e,d,i,t,e,d,,,o,v,e,r,d,u,e,,,r,e,o,p,e,n,e,d,],},),;,/,/,S,e,t,S,e,l,e,c,t,e,d,P,e,r,i,o,d,F,o,r,D,a,s,h,b,o,a,r,d,S,t,a,t,s,a,n,d,E,x,p,o,r,t
For the above I used:
const regex = /[^\\\:\$\s\.\"]/gm;
const plot = document.getElementsByTagName("script")[8].firstChild.data
const array = plot.match(regex)
I think it's the match() method thats inserting the delimiters, so how can I prevent that? And also, how can I write the regex to only include the characters included in the curly brackets?