0
str = 'autocomplete=\\\"off\\\" name=\\\"composer_session_id\\\" value=\\\"1557423901\\\" \\\/>\\u003cinput type=\\\"hidden\\\" autocomplete=\\\"off\\\" name=\\\"is_explicit_place\\\" id=\\\"u436754_5\\\"';
或使用该字符串JavaScript正则表达式问题
session_id\":1557423901,\"include_source\":\"web_composer\",\"allow_cities\":true},\"bootstrapEndpoint\":\"\\\/ajax\\\/places\\\/typeahead.php\"});},\"j4e8191ff7ff1878042874292\":function(){return new Typeahead(JSCC.get('j4e8191ff7ff1878042874291'), {node_id: \"u436754_1\",
我想,中composer_session_id
str.match()
返回值是“1557423901”,也的is_explicit_plac
的id
这是“u436754_5”。
如何使用JavaScript获取“1557423901”和“u436754_5”regex.match() or split or else
?
注意:在每种情况下,保证name
将在value
之前。
是的,这是保证 – user794624
为什么你需要'匹配呢?看起来'split'在这里更适合,只是分割为'id ='和'value ='。 – Anders
将更容易从此字符串 – user794624