using regex to validate input formatting in C#
问题 This is a super basic question (I am brain dead today): How do I validate in input using regexes, to see: 1) if the input is in a certain form 2) if the input is all caps (just casting the input to caps is not feasible for this) I want ot make sure my inputs are in the form XX_XX. Here isi what I have: public bool IsKosher(string input) { Regex r = new Regex(input); if(r.Matches([A-Z]_[A-Z])) { return true; } return false; } Any ideas why it's not compiling? Thank you! 回答1: You are missing