I am trying to create a simple pattern match using regex in SV. I see that its not able to match it although the regex looks right. I tested it out in
module top;
string s = "test[0]";
initial begin
if(s.match(".*[\d].*") ) $display("MATCH");
else $display("NOMATCH");
end
endmodule
Other things that should ideally work but its still no match:
".*\[.\].*"
".*\[.*\].*"
The only thing that I see working is:
".*[0].*"
What if I want to match any number inside the “”?