my $string = <<HTML; this=x that=x x another=x thing=x HTML my @array = $string =~ /(?:^| )(.+?)(?=(?: \w+=|$))/g; print "[$_]\n" for @array; # whoops, was "[$_\n]" # prints: [this=x] [that=x x] [another=x] [thing=x]
Update: Corrected typo, per johngg below.
In reply to Re: Split this string
by hbm
in thread Split this string
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |