Hi,
I need to read a CSV file, i.e. each line is a list of values separated by commas, e.g. “11,22,33,44”.
I want to use the uvm_re_match to split each line to an array of values.
my code looks something like this:
string my_string = “aa,44”;
int return_value;
…
return_value = uvm_re_match(“\w+,\d+”,my_string); //This pattern does not match(return value is 1)
return_value = uvm_re_match(“\D+,\d+”,my_string); //This pattern does not match(return value is 1)
return_value = uvm_re_match(“,\d+”,my_string) ; //This pattern does not match(return value is 1)
return_value = uvm_re_match(“\w+”,my_string) ; //This pattern does not match(return value is 1)
My Questions are:
- Why don’t these patterns match?
- how can I access the matched sub-patterns(i.e. the sub-strings with “( )” around them? In PERL they are numbered by $1 $2 ,…
- in the UVM source code(uvm_regex.svh) there is a
ifndef clause :
ifndef UVM_REGEX_NO_DPI - how can I know whether it applies to me? - Is there a better way to split a string into a list of sub-strings?
Thanks,
Shay