开发者

What's the regular expression to determine if the last two characters of string are 'R' and a number?

I need a regex to determine if a given string ends with 'R' and then a single digit (0-9) for instance TESTR3 would be what I'm looking for whereas 开发者_如何学编程TESTR34 would not.


Like so:

Regex rx = new Regex("R[0-9]$");

Edit: Reverted to [0-9] to avoid matching characters like ٠١٢٣٤٥٦٧٨٩


The expression R\d$ should work.


Use something like: R[0-9]$

http://regexlib.com/CheatSheet.aspx is always helpful as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜