title: How to extract part of string an array of strings in Node.js?
body: <p>I am trying to extract a part of a string for each element in the array.</p>
  
  <p>I have managed to get all files ending with .pdf, but I don't know how to do the extraction part.</p>
  
  <p>I would assume that I need to use a regular expression to do this job, however, I am not sure where to start with that.</p>
  
  <p>Given the first element <code>./pdf/main/test1.pdf</code>, I want to return <code>/test1.pdf</code>.</p>
  
  <p>Follow my code below:</p>
  
  <pre><code>    glob('./pdf/main/*.pdf', {}, (err, files) =&gt; {
        console.log(files) // ['./pdf/main/test1.pdf','./pdf/main/test2.pdf' ]
        files.map(f =&gt; { 
          // Here I want to extract and return the following output:
          // /test1.pdf
          // /test2.pdf
        })
      })
  </code></pre>