I should probably state up front that my understanding of Regexs are very limited, I can do some very basic stuff but really struggle to write my own to match specific patterns.
I need to get the parts of some coordinates from a string. The coordinates can be in any order. So for instance my columns go from 1-15 and the rows from A-O and I want to retrieve the 2 parts separately but they could appear in the string in any order.
The Regex I have is as follows:
([A-Z]{1})([1-9]{1}[0-5]?)
This matches H12 but not 12H. It should also only allow numbers from 1-15 but currently allows numbers greater than that.
In case it makes a difference - I will be using this in c# .Net.
my columns go from 1-15 and the rows from A-O and I want to retrieve the 2 parts separately but they could appear in the string in any order.
You can use this regex:
^(?:([A-O])([1-9]|1[0-5])|([1-9]|1[0-5])([A-O]))$
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments