.* in the sed RE means any number of characters (including 0 characters).
The ^.* at the beginning and the .*$ at the end of your RE do not do anything but waste a few (or many, dependent on the sed implementation) CPU cycles.
Well, the ^.* , because it is a maximum (greedy) match, shifts the remainder to the rightmost match.
\1 in the replacement string in the sed substitute command is replaced by the set of characters matched by expression in the 1st \(expression\) in the basic regular expression used in the sed substitution command's search pattern, \2 is replaced by the set of characters matched by the 2nd \(expression\) , and \3 is replaced by the set of characters matched by the 3rd \(expression\) .
Thanks. That make sense. Question. Would Pass, Reject and All be part of that expression? Or is it just looking for the values of Pass, Reject and All like ([0-9]\ and ([0-9]\ and a-zA-Z]*\?
are Pass= , Reject= , and All= matched by any of the expressions shown in red text between \( and \) pairs? No!
The BRE: abc\(123\)def will match any string that contains the characters abc123def contiguously and in that order. If that BRE is used to match a string in a sed substitute command, \1 in the replacement string will be replaced by the characters that matched the subexpression between the subexpression delimiters \( and \) (in this case the substring 123 ).