Hi Javed
Try the following regex :
@testList =
("SDK_0.9.4.5_20020711_IR_DEV","SDK_0.9.4.5_20020711_IR","SDK0.9.4.5_2002071
1_IR_DEV") ;
foreach $testName(@testList)
{
if($testName =~ /^SDK[_0-9.]*_IR(_DEV){0,1}$/)
{
print "match successful for $testName ! :)\n";
}
else
{
print "match failed for $testName ! :(\n";
}
}
It's much more elegant and flexible :") and i've tried to catch all the
exceptions that may occur in the matching.
Any suggestions \ queries...please let me know.
-aman.
-----Original Message-----
From: Javeed SAR [mailto:SAR.Javeed@;sisl.co.in]
Sent: Thursday, November 07, 2002 12:20 PM
To: [EMAIL PROTECTED]
Subject: pattern
Hi all,
I want to input a string which is used to create file name, and I
want to
allow input string to consist of letters(SDK) at the start and only
IR and DEV inbetween, and numbers(0-9) and
underscore( _ ) within file name.
Is the pattern right.
m/^SDK[0-9]|^SDK_[0-9]|^SDK_[0-9]_IR|^SDK_[0-9]_IR_DEV$/
if ($input =~ /what pattern /){
create file
} else {
exit 0; }
Regards
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]