+ } elseif { [string match "#\\?*" $line_b] } {
+ if { ! $end_1 } {
+ set line_b [string replace $line_b 0 1]
+ set negated [expr { [string index $line_b 0] == "!" }]
+ set line_bx [string range $line_b $negated end]
+ set n [expr { $negated ? "! " : "" }]
+ # Substitute on the reference.
+ foreach {name value} $ref_subst {
+ regsub -- $name $line_bx $value line_bx
+ }
+ verbose "optional match for $n\"^$line_bx$\"" 3
+ if { [expr [regexp "^$line_bx$" "$line_a"] != $negated] } {
+ break
+ }
+ }