title: I need help getting a number from a <p> element with javascript
body: <p>I am new in JavaScript. I have 3 numbers with 10 digits in a <code>&lt;p&gt;</code> tag, and I would like to select and convert them to a link. I was able to get the numbers and convert them to link, but I am getting all 3 numbers at the same time as one link, it would be great if I can get some help, Thank you</p>
  <p>Here is my code:</p>
  <pre><code>&lt;p&gt;
  What 0123456789 exactly is this Worker thread module, 9876543210 and why do we need it? 9768352461 In this post, we will talk about the historical reasons concurrency is implemented in JavaScript and Node.js, the problems we might find, current solutions, and the future of parallel processing with Worker threads.
  &lt;/p&gt;
  
  &lt;script&gt;
  function myFunction() {
    var str = document.querySelector(&quot;p&quot;).innerHTML; 
    var link = 'https://www.google.com/search?q='+text;
    var rgx = /\d{10}/g;
    var text = str.match(rgx);
    var res = str.replace(rgx, '&lt;a href= &quot;'+link+'&quot;&gt;&quot;'+text+'&quot;&lt;/a&gt;');
    document.querySelector(&quot;p&quot;).innerHTML = res;
  }
  
  myFunction();
  
  &lt;/script&gt;
  </code></pre>