A user enters their credit hours per course in my UITextField in this format ....
4,3,4,3,3
(4 credit hours for the 1st year, 3 credit hours for the 2nd year, etc.)
Conditions: The user can enter only MIN during 1 course and MAX 5, credit hours should be separated by a comma, except for the last, the line should contain only numbers and commas (without letters, etc.) in this order.
I am trying to display an error message if the conditions are violated. I think I will need to create regExp. I am not sure how to create it, since the user can enter 2 courses this way ... (3,4), and everything will be fine. (for example, it cannot follow strict formats such as a phone number).
source share