in reply to Regular Expression Question
If the optionals aren't independent, you may need to nest them:/^(\d{6}\.?(?:\d{2})?\w?$/;
Note the use of anchors, to prevent matching part of the name./^(\d{6} #leading digits (?:\.? #if dot, then (?:(?:\d{2})? #if two digits, then \w?)))$/x; #maybe a character
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expression Question
by MistaMuShu (Beadle) on Jul 22, 2004 at 19:02 UTC |