I can't find the right Regex
code to match this:
tttttg
must be truetg
must be truetgg
must be falsetttgg
must be falset
must be truettt
must be trueg
must be falsegggg
must be false
There can be any number of occurrences of t
but at least one and it can optionally have only a g
at the ending.
I tried Match match = Regex.Match("ttgg", @"[t]+{g}|[t]+");
but it returns true, it must return false because there are 2 of g
and there can only be one.