- 632 名前:デフォルトの名無しさん mailto:sage [2019/06/27(木) 12:10:15.36 ID:8RLu6j/60.net]
- string str_url_test = "https://www.rarara.co.jp/xasdfs333ad/code/abcdefg/ref=112&number=555";
//正規表現を定義 string anchor = "https://www.rarara.co.jp/.*/code/(?<code>.*?)/.*"; code の後の abcdefg を抽出する正規表現を定義しました。 一応動いていますが、この正規表現の定義はスマートでない気がします。 Regex re = new Regex(anchor, RegexOptions.IgnoreCase | RegexOptions.Singleline); for (Match m = re.Match(str_url_test); m.Success; m = m.NextMatch()) { string str_test = m.Groups["asin"].Value; Console.WriteLine(str_test); } スマートな定義を教えてください。
|

|