Title: A regular expression question
Your format does not match XXX-XXX-XXX so I'll guess you mean three fields delimited by a dash.
 
#### here's one way to do it
 
$string = "sct-1.62-1";
print "$1\n" if ($string =~ /^.+\-(.+)\-.+$/)
 
 
 
 
 
-----Original Message-----
From: Cai, Lixin (L.) [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 11, 2004 2:37 PM
To: [EMAIL PROTECTED]
Subject: A regular _expression_ question

 Now I have a string like

My $string = "sct-1.62-1";

I have 2 regular _expression_ question here,

A. I want to check whether the format is "XXX-XXX-XXX", how can I do it?
B. I want to get 1.62 from the string, how can I do it?

Thanks a lot in advance!

Lixin


Lixin Cai
Security Compliance Tools(SCT)
Location: ITek 2WC135
Phone:313-317-4906
email: [EMAIL PROTECTED]

 


Message transport security by GatewayDefender
2:40:28 PM ET - 11/11/2004
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to