Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个大字符串,可能有一些我想从中检索的项目。
一个示例字符串可能是
"The quick |Get Me|(header1) brown fox |Get Me|(info package) jumps over ..."
我想要一个正则表达式来提取括号之间的内容,不包括括号,并且括号将始终跟随"|Get Me|"
"|Get Me|"
将匹配的模式:
\|Get Me\|\(([^)]+)\)
用法:
var matches = Regex.Matches(myString, @"\|Get Me\|\(([^)]+)\)"); foreach(Match match in matches) { var val = match.Groups[1].Value; }