DP
Вариант со stackoverflow работает не всегда:
str.match(/<script\b[^>]*>(.*?)<\/script>/gm);
Size: a a a
DP
str.match(/<script\b[^>]*>(.*?)<\/script>/gm);
DP
str.match(/<script\b[^>]*>(.*?)<\/script>/gm);
str.match(/<script[^\0]*?<\/script>/gm);
D
D
SN
D
D
SN
SN
D
JA
D
JA
JA
DP
\nvar initialState=
{}
как кусок текста; // остальной текст до и после удалить