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 - Displaying JSON data posts for blog using just the post id -

docusignapi - Documents restrictions within a package -

javascript - angular.forEach loop with $http.get -