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

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -