Having trouble figuring out a regex issue.
We are looking for 2 numbers then hyphen or space then 6 numbers. Must be only 6 numbers, so either an alpha character or some punctuation or space must follow the 6 numbers or the 6 numbers must be at the end of the string.
Other numbers are allowed elsewhere in the string, as long as they are separate.
So, these should match:
foo 12-123456 bar
12-123456 bar
foo 12-123456
foo12-123456bar
12-123456bar
foo12-123456
12-123456bar 99
foo12-123456 99
These should not match:
123-12345 bar
foo 12-1234567
123-12345bar
foo12-1234567
Here's what we were using:
\D\d{2}[-|/\ ]\d{6}\D
and in Expresso this was fine.
But running for real in our .net application this pattern was failing to match on examples where the 6 numbers were at the end of the string.
Tried this:
\D\d{2}[-|/\ ]\d{6}[\D|$]
and it still doesn't match
foo 12-123456