Regular Expression to Match 1 Character and Single or Double Digit in Any Order

ProNotion

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.

anubhava

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Regular expression to match optional tokens in any order

From Dev

regular expression match digit and characters

From Dev

regular expression match digit and characters

From Dev

PCRE Patterns Regular Expression for Digit Followed by any number of digits and forwards slashes no double slashes ending with digit?

From Dev

Regular expression to match single quotes, double quotes and/or space

From Dev

Regular expression to match all commas outside double and single quotes

From Dev

regular expression to extract any word not (single|double) quote delimited

From Dev

Regular expression: when every alternate character is a digit

From Dev

Use regular expressions to match any number of characters as long as the first character isn't a digit

From Dev

Regular Expression match character OR number

From Dev

Regular expression to match until '{' character?

From Dev

Regular expression to match a standalone = character

From Dev

Regular expression is not working with single character

From Dev

Regular expression to match at least One capital letter and at least One digit and any number of special charecter

From Dev

Regex to match all single or double digit numbers

From Dev

regular expression for match 1 alphabet, 1 digit and allow all special characters

From Dev

.NET regular expression to extract 1-4 digit value from mixed character value

From Dev

.NET regular expression to extract 1-4 digit value from mixed character value

From Dev

Regular expression to match only character or space or one dot between two words, no double space allowed

From Dev

Regular expression to match only character or space or one dot between two words, no double space allowed

From Dev

How to use regular expression to match word without any letter,digital or special character?

From Dev

Javascript: Regular Expression to match 8 digits, one character and one hypen in any sequence

From Dev

How to use regular expression to match word without any letter,digital or special character?

From Dev

How do I match any character across multiple lines in a regular expression for Atom Editor?

From Dev

Regular Expression for a character not appearing between double quotes

From Dev

Regular expression to match first and last character

From Dev

Regular Expression to Match Character and Max Length

From Dev

Regular Expression to Match Exact Character and Numbers

From Dev

regular expression unicode character does not match

Related Related

  1. 1

    Regular expression to match optional tokens in any order

  2. 2

    regular expression match digit and characters

  3. 3

    regular expression match digit and characters

  4. 4

    PCRE Patterns Regular Expression for Digit Followed by any number of digits and forwards slashes no double slashes ending with digit?

  5. 5

    Regular expression to match single quotes, double quotes and/or space

  6. 6

    Regular expression to match all commas outside double and single quotes

  7. 7

    regular expression to extract any word not (single|double) quote delimited

  8. 8

    Regular expression: when every alternate character is a digit

  9. 9

    Use regular expressions to match any number of characters as long as the first character isn't a digit

  10. 10

    Regular Expression match character OR number

  11. 11

    Regular expression to match until '{' character?

  12. 12

    Regular expression to match a standalone = character

  13. 13

    Regular expression is not working with single character

  14. 14

    Regular expression to match at least One capital letter and at least One digit and any number of special charecter

  15. 15

    Regex to match all single or double digit numbers

  16. 16

    regular expression for match 1 alphabet, 1 digit and allow all special characters

  17. 17

    .NET regular expression to extract 1-4 digit value from mixed character value

  18. 18

    .NET regular expression to extract 1-4 digit value from mixed character value

  19. 19

    Regular expression to match only character or space or one dot between two words, no double space allowed

  20. 20

    Regular expression to match only character or space or one dot between two words, no double space allowed

  21. 21

    How to use regular expression to match word without any letter,digital or special character?

  22. 22

    Javascript: Regular Expression to match 8 digits, one character and one hypen in any sequence

  23. 23

    How to use regular expression to match word without any letter,digital or special character?

  24. 24

    How do I match any character across multiple lines in a regular expression for Atom Editor?

  25. 25

    Regular Expression for a character not appearing between double quotes

  26. 26

    Regular expression to match first and last character

  27. 27

    Regular Expression to Match Character and Max Length

  28. 28

    Regular Expression to Match Exact Character and Numbers

  29. 29

    regular expression unicode character does not match

HotTag

Archive