Skip to Content
Former Member
Jul 15, 2008 at 07:38 AM

Validate String with a pattern


How can we validate the string with a pattern?

eg. Value should always be of the format C-DDD,

where C is a character (A-Z or a-z) and

D represents a digit(0-9)

Valid forms are A-001, A-987, Z-098 and

not valid forms are A-01, 1-A01, 1- 0A0, A-A01, A-0001

Say internal table contains values like this.

F1 F2 F3

1 00001 A-001

2 00001 A-A01

3 00001 B-909

4 00001 Z-01

5 00001 k-0001

Valid records are 1 and 3.