In reply to Adarsh Santhosh:
Some tools have added built-in string methods like as show below. If not, a number of other libraries packages like UVM and SVunit.
module top;
string str;
int FILE;
initial begin
FILE=$fopen("fscanf.txt","r");
while($fscanf(FILE,"%s",str) == 1)
if(str.match("([a-zA-Z]+)=([0-9]+)"))
$display("name: %s value: %d",str.backref(0), str.backref(1));
end
endmodule : top