C# Regex replace with Regex -


i have problem, want replace every "[[:de:<text>]]" "{{de|<text>}}" in text. tried

output = regex.replace(input, "[[:de:(.*)]]", "{{de|(.*)}}"); 

but doesnt copy <text>. have no other idea how replace correctly. hope can me.

use lazy dot pattern , backreferences , escape [ symbols:

output = regex.replace(input, @"\[\[:de:(.*?)]]", "{{de|$1}}"); 

if text between de: , ]] can contain line breaks, use regexoptions.singleline modifier.

see regex demo.

enter image description here


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -