On 09/06/2006 09:49 PM, chen li wrote:
Hello all,

I need a regular expression to process some data but
get stuck. I wonder if anyone here might have a clue.

input: my $line='group A 1 2 3 4';# separated by space

 results:
 my @data=("group A ",1,2,3,4);


As Adriano Ferreira said, you don't need a regex for this, but here it goes:

local $\ = "\n";
local $, = "\n";
my $line='group A 1 2 3 4';# separated by space
my @data = $line =~ m/(group A|\d+)/ig;
print @data;

Thanks,

Li



You're welcome.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to