How about this?
/([A-Za-z\-]+\d\d)/;
print "$1\n";
- B
__
Hello all,
I have a var, $DOC_NAME, holding a file name. I need to get the first
part of the variable into another variable. Some examples are
A98-12345, SO-02-789, P-99-029833 and GQE-37-2199.
Examples:
A98-12345,
> Clearly, in the real usage you'll capture and not use $&.
Just in case that's not clear to beginners... one use of
either $&, $' or $` will flush regex performance down the
pan for your whole program. See page 146 of Programming
Perl (3rd Ed, "Camel"). Best to avoid in anything but
trival pro
On 18 May 2002 04:21, John W. Krahn [mailto:[EMAIL PROTECTED]] wrote:
> Bill Akins wrote:
> >
> > Hello all,
>
> Hello,
>
> > I have a var, $DOC_NAME, holding a file name. I need to
> get the first
> > part of the variable into another variable. Some examples are
> > A98-12345, SO-02-789, P-
Bill Akins wrote:
>
> Hello all,
Hello,
> I have a var, $DOC_NAME, holding a file name. I need to get the first
> part of the variable into another variable. Some examples are
> A98-12345, SO-02-789, P-99-029833 and GQE-37-2199.
>
> Examples:
> A98-12345, I need A98
> SO-02-789, I need SO-02
Hello all,
I have a var, $DOC_NAME, holding a file name. I need to get the first
part of the variable into another variable. Some examples are
A98-12345, SO-02-789, P-99-029833 and GQE-37-2199.
Examples:
A98-12345, I need A98
SO-02-789, I need SO-02
P-99-029833 I need P-99
GQE-37-2199 I need G