in reply to do $n exist in grep?

You wrote: Is $1 captured somewhere?

I hope that this blizzard of replies to your post makes it clear that the parens do capture $1!

Perl regex is super duper cool and there is a way to not capture A or B into $1. But I think that syntax is way past what you are asking for.