title: How do I count how many times a string occur in a file using javascript?
body: <p>How to count no. of occurrences of a regex string or a html tag in the entire file using javascript?
  Say for example, I want to find how many <code>&lt;a href="graphic[0-9]+"&gt;</code> tags are present in a file and store that value in a variable. How do I achieve that?</p>