Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi, which is a simpler version of your RE, and try and match it against "___abc___def" (the "_" represents spaces). First, perl matches \s+ against the three spaces, and the first (.*) against all the other acaracters (that is "abc___def". But now there is a \s+, which require at least a space, so the first .* grundly gives back one character at time, until it only matches "abc__" (two spaces). Now \s+ matches this space, and the second (.*) is free to match "def". After that, $1 is "abc__", and $2 is "def". I hope this explain things... Cheers Leo TheHobbit In reply to Re: perl regex with '\s+'
by TheHobbit
|
|