On 2012-07-27 17:43, Andy Bach wrote:
On Fri, Jul 27, 2012 at 10:22 AM, Dr.Ruud <rvtol+use...@isolution.nl> wrote:
On 2012-07-27 16:58, Andy Bach wrote:
if ($model=~/(\S+)\s+(.*)\s*$/) {
The \s* in the end does nothing.
Well, I was thinking if it's a multi-word second match:
v6 Austin Martin<space><space>
Then that would matches the rest of the phrase and trims trailing blanks.
The '.*' already picks up any trailing blanks. So they will be in $2.
But making it non-greedy, works:
perl -wle '
/(\S+)\s+(.*?)\s*$/ and print "<$1><$2>"
for "v6 Aston Martin ";
'
<v6><Aston Martin>
(which surprised me, and I would never use it like that,
because for me it is not explicit enough)
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/