TCL script to delete a pattern(regexp)

Hi

I am writing a TCL script to delete a certain in a file

My Input file

module bist_logic_inst(a, ab , dhd, dhdh , djdj, hdh, djjd, jdj, dhd, dhp, dk
);
input a;
input ab;
input dhd;
input djdj;
input dhd;
output hdh;
output djjd;
output jdj;
output dk;




bist_reverse_mapper 
#(.ksks, jsjs, sjsk, hsjhs , hshs, hshjs, jsjs),
.dhdhd::hdhdhdhd),
kdkd,jdjd ,jdjd),
jdjd(jdjd))
Umbist_reverse_inst(  .BIST_SO(), .BIST_SO_ts1(), .BIST_SO_ts2(), .BIST_SO_ts3(), .BIST_GO(), .BIST_GO_ts1(), 
      .BIST_GO_ts2(), .BIST_GO_ts3(), .clk_mbist(), .BIST_SETUP(), .ltest_to_mcp_bounding_en(), 
      .MEM0_BIST_COLLAR_SI(), .MEM1_BIST_COLLAR_SI(), .MEM2_BIST_COLLAR_SI(), .MEM3_BIST_COLLAR_SI(), 
      .bistEn(), .BIST_COLLAR_DIAG_EN(), .ltest_to_en(), .BIST_EVEN_GROUPWRITEENABLE(), 
      .BIST_ODD_GROUPWRITEENABLE(), .BIST_SELECT(), .BIST_WRITEENABLE()
  );

endmodule 

I have to delete the content in between # and ))

My output file

module bist_logic_inst(a, ab , dhd, dhdh , djdj, hdh, djjd, jdj, dhd, dhp, dk
);
input a;
input ab;
input dhd;
input djdj;
input dhd;
output hdh;
output djjd;
output jdj;
output dk;




bist_reverse_mapper 

Umbist_reverse_inst(  .BIST_SO(), .BIST_SO_ts1(), .BIST_SO_ts2(), .BIST_SO_ts3(), .BIST_GO(), .BIST_GO_ts1(), 
      .BIST_GO_ts2(), .BIST_GO_ts3(), .clk_mbist(), .BIST_SETUP(), .ltest_to_mcp_bounding_en(), 
      .MEM0_BIST_COLLAR_SI(), .MEM1_BIST_COLLAR_SI(), .MEM2_BIST_COLLAR_SI(), .MEM3_BIST_COLLAR_SI(), 
      .bistEn(), .BIST_COLLAR_DIAG_EN(), .ltest_to_en(), .BIST_EVEN_GROUPWRITEENABLE(), 
      .BIST_ODD_GROUPWRITEENABLE(), .BIST_SELECT(), .BIST_WRITEENABLE()
  );

endmodule 

The script which I have written is

set filename6  "output_dir/mbisttop_${ip}.v"

# Read in the data; this is good even for pretty large files
set f_6 [open $filename6]
set lines3  [read  $f_6]
close $f_6


set pattern1  "#(.*?))"
set elim1 [regsub $pattern1 $lines3 ""]
set f_8 [open ff.v "w"]
puts -nonewline $f8 $elim1 

But this one is not working .

Please tell me whether the below stated pattern is correct ?

set pattern1  "#(.*?))"

First appearing in 1988; 31 full years ago, many most people here do not use TCL these days, it seems.

I have not used TCL in decades, so I cannot help either.

There are simply more modern programming languages to use with more robust support.

Sorry, we cannot be more helpful.