简体   繁体   English

使用Regular Expression在两个字符串之间获取字符串

[英]Get string between two string with Regular Expression

I have a string that look like this 我有一个看起来像这样的字符串

BLA BLA BLA "url_encoded_fmt_stream_map": "ABCDEFGHIJKLMN" BLA BLA BLA BLA

And i want to get the string ABCDEFGHIJKLMN,i tried to do it with REGX: 我想得到字符串ABCDEFGHIJKLMN,我试图用REGX做:

html = html.match("\"url_encoded_fmt_stream_map\": \"(.*)\"");

But it always give me an empty string.Any idea what is the problem with this method? 但它总是给我一个空字符串。任何想法这个方法有什么问题?

Try it without the quotes: 尝试不带引号:

html = html.match(/"url_encoded_fmt_stream_map\": \"(.*)"/);

the slashes tell javascript it is a regular expression. 斜杠告诉javascript它是一个正则表达式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM