in reply to
Re^2: Parenthesis grouping into regexes.
in thread Parenthesis grouping into regexes.
Labelling groups (with (?pattern) regex) showed me what was happening. It is all clear now.
Many thanks to everyone, specially BillKSmith!
I was having a trouble when using $1, $2... because I didn't know they exact behaviour.
The problem I had was with the parenthesis inside $ip4 regex, causing $2 to have an ip address,
$3 had the match inside the parenthesis in $ip4, and the prefix I expected put into $4:
# Example of my debug output:
line = '*> 18.104.22.168/21 22.214.171.124 0 200'
matches: $1:'*> ' $2:'126.96.36.199' $3: '16.' $4:'/21'
Now I understand how $1, $2, $3... are set.
Thank you all, Monks! =D