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.
私はこれを使います
string matchString = Regex.Match(sometext, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase).Groups[1].Value;
画像の src を取得します。
しかし、見つけたすべての src を取得するにはどうすればよいでしょうか?
ありがとう!
Match の代わりに Regex.Matches を使用し、Multiline オプションを追加する必要があります。
foreach (Match m in Regex.Matches(sometext, "<img.+?src=[\"'](.+?)[\"'].+?>", RegexOptions.IgnoreCase | RegexOptions.Multiline)) { string src = m.Groups[1].Value; // add src to some array }