How to access multiple capture groups in AUTOINST REGEXP?
I'm wanting to pull out a number of terms from an AUTOINST regexp but can't find an example. If I have two module instance names of "u_tx0" and "u_tx1" with a regext of "_\(tx\([0-9]\)\)", I'm expecting to see two capture groups. The first would have the full "tx0" or "tx1" ; the second "0" and "1".
How do I access the second capture group? The documentation/manual talks about using multiple groups but only gives the example of using @ to get the first group.
#2 Updated by Shareef Jalloq 28 days ago
What about in the instance name rather than the ports? Or what happens if I have two lots of regex?
/* mymodule AUTO_TEMPLATE "\(tx\([0-9]+\)\)" .\(CTRL[0-9]+\) (@_\1[X]), ); */
In the above example, I want to replace X with the second capture group from the instance name.
I want the following:
mymodule u_tx5 (.CTRL0 (tx5_CTRL0));
#3 Updated by Wilson Snyder 28 days ago
Sorry, thought you were referring to a template of a AUTOINST. The cell name regexp attached to the AUTOINST itself only uses \\1 as @. For anything else you need lisp code using vl-cell, see https://github.com/veripool/verilog-mode/blob/master/FAQ.adoc#how-do-i-have-auto_template-use-the-second-number-in-a-instance-name
Also available in: Atom