quickly snag all numbers

2005-11-02 Thread Bryan R Harris
I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss = qr/(^|\s)[+-]?[0-9]+\.?[0-9]*([eE][+-]?[0-9]+\.?[0-9]*)?($|\s)/; @list = m/$ss/g; ... but it slurps

RE: quickly snag all numbers

2005-11-02 Thread Charles K. Clarkson
Bryan R Harris mailto:[EMAIL PROTECTED] wrote: : I'd like to snag all the whitespace padded numbers in $_ into an : array, e.g. in the following: : : 1 M_fx,-3,+2.p2 -31.4e-1 4. Can you give more than one example? If everything fits this form, then don't look for numbers. Just delete

Re: quickly snag all numbers

2005-11-02 Thread Bob Showalter
Bryan R Harris wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss = qr/(^|\s)[+-]?[0-9]+\.?[0-9]*([eE][+-]?[0-9]+\.?[0-9]*)?($|\s)/; @list =

Re: quickly snag all numbers

2005-11-02 Thread Jay Savage
On 11/2/05, Bryan R Harris [EMAIL PROTECTED] wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss =

Re: quickly snag all numbers

2005-11-02 Thread Bryan R Harris
Bryan R Harris mailto:[EMAIL PROTECTED] wrote: : I'd like to snag all the whitespace padded numbers in $_ into an : array, e.g. in the following: : : 1 M_fx,-3,+2.p2 -31.4e-1 4. Can you give more than one example? The script is intended to normalize all the data in a file. It

Re: quickly snag all numbers

2005-11-02 Thread Bryan R Harris
Bryan R Harris wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss = qr/(^|\s)[+-]?[0-9]+\.?[0-9]*([eE][+-]?[0-9]+\.?[0-9]*)?($|\s)/;

Re: quickly snag all numbers

2005-11-02 Thread Bob Showalter
Bryan R Harris wrote: Bryan R Harris wrote: I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss =

Re: quickly snag all numbers

2005-11-02 Thread Bryan R Harris
I'd like to snag all the whitespace padded numbers in $_ into an array, e.g. in the following: 1 M_fx,-3,+2.p2 -31.4e-1 4. I'd like to pick up only the 1, -31.4e-1, and 4. I've tried: $ss = qr/(^|\s)[+-]?[0-9]+\.?[0-9]*([eE][+-]?[0-9]+\.?[0-9]*)?($|\s)/; @list = m/$ss/g; ...