问题描述
你好,先生,我必须访问text之后的所有字符串:
i必须提取 - SAP Remote Basis Support @ $ 2.29 \ /小时\ /每服务器.24x7x365支持.http:\ / \ / t.co \ / oFuPepEB8c此声明出现text属性
来自
[{created_at:Tue Aug 27 21:18:38 +0000 2013,id:372468218289340416,id_str:372468218289340416,文本:SAP远程基础支持@ $ 2.29 \ / hour \ /每台服务器.24x7x365支持.http:\ / \ / t.co \ / oFuPepEB8c,source:\ u003ca href = \http:\ / \ / www.tweetdeck.com \ = \nofollow \\ u003eTweetDeck \ u003c \ / a \\\ 0000
请用正则表达式或其他方法帮助我
hello sir i have to access all string which is come after "text":
i have to extract- "SAP Remote Basis Support @ $2.29\/hour\/per server. 24x7x365 Support. http:\/\/t.co\/oFuPepEB8c" this statement occur "text" attribute
from
[{"created_at":"Tue Aug 27 21:18:38 +0000 2013","id":372468218289340416,"id_str":"372468218289340416","text":"SAP Remote Basis Support @ $2.29\/hour\/per server. 24x7x365 Support. http:\/\/t.co\/oFuPepEB8c","source":"\u003ca href=\"http:\/\/www.tweetdeck.com\" rel=\"nofollow\"\u003eTweetDeck\u003c\/a\u003e"]
please help me with regular expression or other method
推荐答案
string result = Regex.Match(input, "\"text\":\"(?<txt>[^,\"]+)\"").Groups["txt"].Value;
如果您有多个 text
变量输入,试试这个:
If you have more than one text
variable in your input, try this:
string[] results = Regex.Matches(input, "\"text\":\"(?<txt>[^,\"]+)\"").Cast<Match>().Select(x => x.Groups["txt"].Value).ToArray();
希望这会有所帮助。
Hope this helps.
这篇关于从字符串中提取特定文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!