regular expression: extract last 2 characters
Use the regex:
..$
This will return provide the two characters next to the end anchor.
Since you're using C#, this would be simpler and probably faster:
string fullexpression = "A_IL";
string StateCode = fullexpression.Substring(fullexpression.Length - 2);
Use /(..)$/
, then pull group 1 (.groups(1)
, $1
, \1
, etc.).