B
Byron
I'm looking for an expression that checks that within a string only certain
characters appear, and that they appear at most 1 time. For example, a
string can have up to 4 unique digits between 1 and 4.
The following strings should pass:
D-1
D-14
D-1234
D-41
The following should fail:
D- (no digit)
D-0 (out of range)
D-5 (out of range)
D-11 (repeated digit)
D-1 2 (embedded space)
D-12345 (out of range and too long)
The expression "D-[1234]{1,4}" comes close, but it matches even when a digit
is repeated within the string.
Any help would be greatly appreciated.
characters appear, and that they appear at most 1 time. For example, a
string can have up to 4 unique digits between 1 and 4.
The following strings should pass:
D-1
D-14
D-1234
D-41
The following should fail:
D- (no digit)
D-0 (out of range)
D-5 (out of range)
D-11 (repeated digit)
D-1 2 (embedded space)
D-12345 (out of range and too long)
The expression "D-[1234]{1,4}" comes close, but it matches even when a digit
is repeated within the string.
Any help would be greatly appreciated.