Re: Regex, search until second digit

2002-05-20 Thread Bryan R Harris
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,

RE: Regex, search until second digit

2002-05-20 Thread Jonathan E. Paton
> 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

RE: Regex, search until second digit

2002-05-20 Thread Richard_Cox
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-

Re: Regex, search until second digit

2002-05-17 Thread John W. Krahn
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

Regex, search until second digit

2002-05-17 Thread Bill Akins
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