Well, there are a couple of issues here.  First off, I don't think this
would even compile, because you used /s instead of \s.  Secondly, your
regex is looking for:

--------------------

.*              zero or more of any character
                (unnecessary, since you didn't anchor the start of the
string)

\(ucmvob\)      the string '(ucmvob)'

\s*             zero or more whitespace characters

$               the end of the string

----------------------

I think what you might be looking for is something similar to this:

/\(ucmvob\)/

or possibly this:

/\(ucmvob,.*?\)/

which would match 'ucmvob', a comma, and any other text (non-greedy
match) between parentheses.


Of course, I can't test this where I am, but that should get you
started.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Cai, Lucy (L.)
Sent: Wednesday, April 26, 2006 6:46 PM
To: perl-win32-users@listserv.ActiveState.com
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Regular expression question

Hi, all,
 
I have a question about regular expression:
 
my code is like this:
**********************************************************************
sub IsPVob
{
        my ($Vob) = @_;
 
        my $Output = `cleartool lsvob $Vob`;
        die "IsPVob can't list vob $Vob"  if $?;
 
        return (($Output =~ /.*\(ucmvob\)/s*$/) ? 1 : 0);

}
**********************************************************************
 
$Output ="/vobs/na_mscs_pvob
/ccstore/ecc/vobs_fcis321/na_mscs_pvob.vbs public (ucmvob,replicated)"
 
What I want to do is if this tring include word "ucmvob", then return 1,
else return 0.
 
My code does not work, it return 0. Could you please see why it is like
this? or do you have a better idea?
 
Thanks a lot inadvance!
 
Lucy
 

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to