给出以下字符串:
"<head></head><body>{"filesize":55312,"success":false,"msg":"incorrect-captcha-sol"}<div firebugversion="1.5.4" style="display: none;" id="_firebugConsole"></div></body>"
我需要提取JSON字符串,如下所示:
{"filesize":55312,"success":false,"msg":"incorrect-captcha-sol"}
我该怎么做?
谢谢
答案 0 :(得分:2)
json = str.match(/(\{[^}]+\})/)[1];
答案 1 :(得分:1)
json = str.match(/([^<]+)/)[1];
答案 2 :(得分:1)