Hi need Reg Ex help
-
Hi i need to check pattern of a file name using Regular Expression. The file name is something like "TRANS#7_26_2007.xls" ie "TRANS#[MM]_[DD]_[YYYY].xls" Can any one please help me.... Thanks,....
Vikram I Code...
Hi Vikram I think the pattern you need is
TRANS#\d{1,2}_\d{1,2}_\d{4}\.xls
. The "\d" matches any numeric character. The "{x,y}" pattern matches the preceding character between x and y times (i.e. your example showed that the months may be expressed as a single digit). The "{4}" pattern matches the preceding character exactly 4 times. The "\" says to treat the following character as a literal (because "." is a special matching character). Hope that helps. Regards Andy I code too...If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".