$cnt =0 $str="hi hi harshmane hi hi"; if ($str=~/([hi]+)/g) { $cnt++; } print $cnt; [download]
In reply to how to find substring using regex by harshmane