A regular expression that can be used to get the last X (2, for example) characters of a string.
/.{2}$/g
Matches:
- 123456
- RegexPattern
- Regex.us
See Also:
- Regex To Match The Last Occurrence Of Characters In A String
- Regex To Match The First Word Of Each Line In A Multiline Text Block
- Regex To Match The First X Characters In A Sentence
- Regex To Match First Numbers In A String
- Regex To Match Any Numbers But The Last X Digits