---------- Forwarded message ----------
From: Anshul Saxena <[EMAIL PROTECTED]>
Date: Oct 23, 2006 8:38 AM
Subject: Re: reg expression again
To: chen li <[EMAIL PROTECTED]>

You should try :
my $file_name =~ /^(OT).*(\d+$)/

The caret ^ when outside any brackets, indicates that the character you are
trying to match should be at the beginning.
I hope this works. Lemme know if it doesn't.

Regards

On 10/22/06, chen li <[EMAIL PROTECTED]> wrote:

Hi all,

I write a small script as follows:

use strict;
use warnings;

my $file_name='OT-q1.001';

if ($file_name=~/(OT)*.(\d+$)/){
         print "find it\t $file_name";
}else {print "No math";}

The problem is that it also macth the following
string:

my $file_name='I:/Common/Notebooks/Trans10C.032';
(ot in the Notebook)

Any help will be appreciated.

Li


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> < http://learn.perl.org/first-response>



Reply via email to