This project is read-only.


Regular Expression support doesn't like digits


Attempt to resolve a RegularExpressionRequest for a set of digits, e.g. with this pattern:


That pattern means 'exactly 8 digits', and a string like this satisfies the pattern: "12345678"

However, an attempt to resolve a new RegularExpressionRequest(@"\d{8}") returns a NoSpecimen result.
Closed Jan 27, 2013 at 5:04 PM by baxevanis
Resolved in version (changeset a365f031aa)


baxevanis wrote May 19, 2012 at 2:30 PM

That's very interesting.

The original, Java, version prints "dddddddd" for the pattern @"\d{8}".

AutoFixture's RegularExpressionGenerator yields the same result "dddddddd". That is the reason why a NoSpecimen request is returned.

On the other hand Rex (from Microsoft Research) generates a valid string.

Till there is a solution to this, does this pattern help? @"[0-9]{8}"

baxevanis wrote May 19, 2012 at 2:51 PM

I am thinking to add more test cases, in the "NotSupportedRegexPatternTestCases" nested class, in order to cover this page as much as possible. Though, I am not sure if this is a complete list.

ploeh wrote May 19, 2012 at 3:25 PM

That workaround with the other pattern worked like a charm :) Thanks