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