language: C# (mono-2.8)
date: 1103 days 17 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Text.RegularExpressions;
 
public class Test {
public static void Main() {
 
string[] lines = {
  "The quick brown fox jumps over the lazy dog",
  "The quick brown fox jumps over the lazy dog {tag}",
  "The quick brown fox jumps over the {lazy} dog",
  "The quick brown fox jumps over the {lazy} {dog}",
};
 
Regex r = new Regex(@"\{(\w+)\}$", RegexOptions.RightToLeft);
 
foreach (string line in lines) {
  Console.WriteLine("[" + r.Match(line).Groups[1] + "]");
}
 
 
}
}