I’ve designed a multilingual web site and some values in database have a tag which will be replaced with it’s language value, remove tags brackets ( in case {} ) or removed completely.
There are two cases:
Remove brackets:
value {mm} >> value mm
Remove completely:
value {mm} >> value
Also {tag} could be any length and can contain –
Can anybody help me with regex?
Here is some code you might find useful. For many many more options, see Regular-expressions.info.
All code
Using System.Text.RegularExpressions;Remove all occurrences of
{mm}(and onlymm):Replace all occurrences of
{mm}(and onlymm) withmm:Remove all occurrences of
{any-characters}:Replace all occurrences of
{any-characters}withany-characters: