I am reading in a very messy file with very little (if any) format. I am looking for the following two of which I have working properly.
- Name (first and last) working
- Email addresses (varying types (eg. .edu .net .com) There could be others as well.) working
- Employee number (two capital letters followed by 5 digit values then the same two letters as the first but reversed) NOT Working
The code I have currently for the Employee regex:
string employeeNumber = @"(?<grp1>[A-Z]{2})[0-9]{5}[A-Z]{2}";
This finds the required values, but would also find invalid employee numbers since it is not actually looking for the first two capital chars in the opposite order.
What I would like in the end is to some how use the <grp1>
only in the reversed order.
Example of a valid employee number XY12345YX.
I could not find any good documentation on any type of regular expression group reversal. Any Ideas would be great!
EDIT:
This is an example of a line from a text document that I am reading in.
'Name list from PQP-97 system &%$ Bill Williams MK12345KM bwilliams01@msn.com ^ %20%
Fredericka Hanover GW22887WG freddie@verizon.net'