Dr. Claus-Peter Becke wrote:
> foreach (/(\w+)/i) {
> push @words,$&;
> }
> print$q->popup_menu('to_thesaurus', @words);
>
> this solution succeeds in finding and returning the last element...
There are a few problems here:
1. regex should use the /g modifier to find all matches in the stri
I went back to my books to refresh my memory on how to use references. Your
suggestion help a lot, but the subroutine returns wrong values. I did
some small modifications on the codes below
, and tried it. It return perl-5.8.0-80.3.i386.rpm and
samba-2.2.7-5.8.0.i386.rpm, which is wrong because:
<[EMAIL PROTECTED]>
To: "Kamali Muthukrishnan" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 26, 2002 9:48 AM
Subject: RE: pattern matching for serial number
> well, the second slash should follow immediately after the bracket
L PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: pattern matching for serial number
>
>
> Sorry, while typing I missed the slash, it is there in my code as -
> if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /)
> Is there any thing wrong with this ?
> Kamali
> >>
Sorry, while typing I missed the slash, it is there in my code as -
if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /)
Is there any thing wrong with this ?
Kamali
>>> fliptop <[EMAIL PROTECTED]> 04/26/02 08:54AM >>>
Kamali Muthukrishnan wrote:
> Hi guys :
> I have serial numbers with a pattern : 3 nu
> -Original Message-
> From: Kamali Muthukrishnan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, April 26, 2002 9:39 AM
> To: [EMAIL PROTECTED]
> Subject: pattern matching for serial number
>
>
> Hi guys :
> I have serial numbers with a pattern : 3 numbers followed by
> 2 capital letters fo
Kamali Muthukrishnan wrote:
> Hi guys :
> I have serial numbers with a pattern : 3 numbers followed by 2 capital letters
>followed by 3 numbers.
> To validate this -
> if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} )
> { # display error ; }
> I get a syntax error.
i think you're missing a