私はそのような文字列を持っています:
Text [City 1 || Location] text [Population]
|| Text [City 2 || Location] text [Population]
|| を置き換える正規表現が必要です ==で[]内だけ。
だから私はする必要があります:
Text [City 1 == Location] text [Population]
|| Text [City 2 == Location] text [Population]
私はこの正規表現を書きました:
str = Regex.Replace(str, @"\[(.*?)\|\|(.*?)\]", "[$1==$2]");
しかし、それはすべてを置き換えます || ==で。
修正方法は?