I'm trying to practice writing better code, so I wanted to validate my input sequence with regex to make sure that the first thing I get is a single letter A to H only, and the second is a number 1 to 12 only. I'm new to regex and not sure what the expression should look like. I'm also not sure what type of error R would throw if this is invalidated?
In Perl it would be something like this I think: =~ m/([A-M]?))/)
Here is what I have so far for R:
input_string = "A1"
first_well_row = unlist(strsplit(input_string, ""))[1] # get the letter out
first_well_col = unlist(strsplit(input_string, ""))[2] # get the number out