Quote:
Originally Posted by
theexitwound
Thanks for the explanation of the first bit there. I was confused.
As for the back-referencing in sed, what if I don't know how many variables are being passed in the function?
I already demonstrated that. Look at my 'prints third match' example. You can use * to search for repeats of entire \( \) blocks to select more than one thing.
Forgetting all the silly \s for the moment,
(,[a-z])* matches ,a,b,c,d,e,f,g and gives you ",g" as the backreference.
((,[a-z])*) matches ,a,b,c,d,e,f,g and gives you
,a,b,c,d,e,f,g as the first backreference and
,g as the second.
You could get a,b,c,d,e,f,g with
((,?[a-z])*) since ? makes the char before it optional.