I am writing a script that will search a system Verilog testbench and pul out the modules and then search the modules hierarchy until it reaches the very bottom of the chain.
Is there any way to search for a pattern, and then take the element that comes just BEFORE the specified string? These files are all different except they will always have the element I need here...
//random code//
element_needed #(...)
or
//random code//
element_needed
#(....
....)
I need the keyword that comes just before the #(
. Ive been working with regexp
but any ideas would be a huge help!