I am trying to create a Regex pattern that forces a string to match this format: A99.9. (Alpha, Numeric, Numeric, Period, Numeric). I am trying to build this into a business rule in Master Data Services. Anyone have any thoughts?
Asked
Active
Viewed 2,357 times
1 Answers
0
Copy + Paste /[A-Z][0-9]+\.[0-9]+/
make sure insensitive is selected; (so /[A-Z][0-9]+.[0-9]+/) how ever do you have any other formats you want to try? Is it really just A99.9, B88.8, C77.7 and so forth?

DdD
- 453
- 4
- 19
-
Thanks for the quick response. It is case sensitive. I would like it to only accept UPPERCASE. For right now, the only formats will be this one, the A99.9, B88.8, C77.7. I can alter it in the future if needed, but right now I am trying to restrict users from entering anything other than that format into the MDS Excel add-on. – nation161r Nov 07 '16 at 22:56
-
Ok makes sense, I've modified my answer; it'll strictly only accept A99.9, B88.8 and so forth - If it is really just to be A99.9 and not A99.987, you can remove the last plus at the end of the regex – DdD Nov 07 '16 at 23:07
-
Thanks! I altered it slightly to this: ^[A-Z][0-9][0-9]\.[0-9]$ This forces the exact format to be matched with the way the business rules work within MDS. – nation161r Nov 07 '16 at 23:34
-
You can also use an exact quantifier /^[A-Z][0-9]{2}\.[0-9]/ instead of + (which means one or more matches). In case you would ever have to match exactly 8 digits you would avoid having to copy [0-9] various times. – OriolAbril Mar 27 '18 at 22:49