C#httpwebresponse stream - 在标签之间获取文本(正则表达式)

时间:2018-05-26 09:26:48

标签: c# regex httpwebresponse

我目前正在使用httpwebrequest& httpwebresponse从网页中提取innerhtml,但我试图在标签之间提取特定数据..

例如 -

 <script>

 RESPONSIVE = {
     example: 'Hello world',
     name: 'Example',
     id: '32',
 };

 </script>

我试图从该特定标签中提取的内容是

中的文字
name:

标签

即,

Example

如果字符串以name开头,我可以做一些事情:&#39;并以&#39;结束,获取内在内容?

1 个答案:

答案 0 :(得分:0)

您的任务的简单正则表达式可能如下所示: ^\s*(?<name>\w+): '(?<value>.*)',?$

您可以在此处试用:https://regex101.com/r/jqZfqj/2