Q:

Regex to get array from content?

I'm calling a webpage using the Request library, and I am storing the response body as a javascript variable.  The response body consists of the HTML of the page.  Ignore the fact that this is javascript, I cannot edit the code below.  Think of it as a text string I need to perform regex on.
Below is a snippet of the response body, however I need to perform some regex to extract the contents of the sales_rank array.
So far I have the below, but I am struggling to know where to go next:
\sales_ranks = \[()/g
(function() {
            var chart = $(document).find('#flot-chart'),
                sales_ranks = [
                                                [1498101635000, 0],
                                                [1498187306000, 0],
                                                [1498274424000, 0],
                                                [1498360866000, 0],
                                                [1498447842000, 0],
                                                [1498534646000, 0],
                                                [1498620767000, 0],
                                                [1498706919000, 0],
                                                [1498793120000, 259312],
                                                [1498879764000, 490981],
                                                [1498965369000, 633892],
                                                [1499052315000, 792398],
                                                [1499138463000, 215732],
                                                [1499225377000, 435596],
                                                [1499311360000, 110890],
                                                [1499398681000, 299988],
                                                [1499484963000, 194321],
                                                [1499571308000, 184823],
                                                [1499657546000, 282991],
                                                [1499744175000, 96775],
                                                [1499830311000, 399822],
                                                [1499916360000, 483213],
                                                [1500002994000, 284743],
                                                [1500089388000, 163017],
                                                [1500175564000, 101008],
                                                [1500261919000, 131600],
                                                [1500349007000, 60496],
                                                [1500434715000, 134451],
                                                [1500521280000, 151996],
                                                [1500607500000, 145079],
                                        ]

If anyone know how to do this, it'd be much appreciated if you could help.  Alternatively, if you know of a way to extract the array when storing the html in a javascript variable, that could also work

A:

For your given text, following regex should work:
/\bsales_ranks\s*=\s*\[(?:\s*\[[^\]]+\],)+\s*\]/ig

RegEx Demo
RegEx Breakup:

\b : assert word boundary
sales_ranks : match literal sales_ranks
\s*=\s* : match = surrounded by whitespaces on both sides
\[ : match literal [
(?: : start non-capturing group

\s*\[[^\]]+\], : match whitespaces followed by [...], elements

)+ : end non-capturing group. + means match all of the inner elements
\s* : match 0 or more whitespaces
\] : match last closing ]

