Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Regular Expressions with varialbe with "[]"

by Anonymous Monk
on Mar 10, 2015 at 14:12 UTC ( [id://1119505]=note: print w/replies, xml ) Need Help??


in reply to Regular Expressions with varialbe with "[]"

The characters [] are special in regexes, and you need to escape them with \Q...\E aka quotemeta. If I replace ${port_name} with \Q$port_name\E, I get the output "$port_name = sdm_yout_i[1]  cell name = dout_sar". If you want the "cell name" to be "sdm_yout_i", you need to further restrict your regex and replace the .*? just before $port_name with something like \W*.

But this still all feels a bit like a hack. You've been advised to use real Verilog parsers like Verilog::VCD and Verilog-Perl in four separate threads now (out of five total). Perhaps it's about time you looked into getting those installed?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1119505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-23 11:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found