I want to run a script where I can specifically select ID tag where parameters are   
 **\_string\_n\_n**   
where *'\_string'* = release (in this case) and *'n'* = are numbers #   
e.g. **\_release\_8\_3**

Here's my code... where I wan to run the script and get content of tag where ID matches \_string\_n\_n  

```
<div class="sect2">
      <h3 id="_release_8_3">Release 8.3</h3>
      <div class="sect3">
        <h4 id="_qa_test_release_1_2_4_to_take_a_look_at_manifest">QA TEST release 1.2.4 (to take a look at manifest)</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-1.2.4.html">Release Manifest</a></p>
            </li>
          </ul>
        </div>
      </div>
      <div class="sect3">
        <h4 id="_qa_test_release_1_2_3_to_take_a_look_at_manifest">QA TEST release 1.2.3 (to take a look at manifest)</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-1.2.3.html">Release Manifest</a></p>
            </li>
          </ul>
        </div>
      </div>
      <div class="sect3">
        <h4 id="_qa_release_8_3_1">QA release 8.3.1</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-8.2.6.html">Release Manifest</a></p>
            </li>
            <li>
              <p>Bugs <a href="link">fixed in this release</a></p>
            </li>
            <li>
              <p>Package updates:</p>
              <div class="literalblock">
                <div class="content">
                  <pre>user-portal 8.2</pre>
                </div>
              </div>
            </li>
            <li>
              <p>Database migration scripts to run:</p>
              <div class="literalblock">
                <div class="content">
                  <pre>none</pre>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <div class="sect2">
      <h3 id="_release_8_2">Release 8.2</h3>
      <div class="sect3">
        <h4 id="_qa_test_release_1_2_4_to_take_a_look_at_manifest_2">QA TEST release 1.2.4 (to take a look at manifest)</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-1.2.4.html">Release Manifest</a></p>
            </li>
          </ul>
        </div>
      </div>
      <div class="sect3">
        <h4 id="_qa_test_release_1_2_3_to_take_a_look_at_manifest_2">QA TEST release 1.2.3 (to take a look at manifest)</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-1.2.3.html">Release Manifest</a></p>
            </li>
          </ul>
        </div>
      </div>
      <div class="sect3">
        <h4 id="_qa_release_8_2_6">QA release 8.2.6</h4>
        <div class="ulist">
          <ul>
            <li>
              <p><a href="release-manifest-8.2.6.html">Release Manifest</a></p>
            </li>
            <li>
              <p>Bugs <a href="link">fixed in this release</a></p>
            </li>
            <li>
              <p>Package updates:</p>
              <div class="literalblock">
                <div class="content">
                  <pre>user-portal 8.2</pre>
                </div>
              </div>
            </li>
            <li>
              <p>Database migration scripts to run:</p>
              <div class="literalblock">
                <div class="content">
                  <pre>none</pre>
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>

```
['https://Stackoverflow.com/questions/44162581', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5326191/']
Select all elements with an ID containing the following string (in this case `_release_`:

`document.querySelectorAll("[id*='_release_']");`

In jQuery: `$("[id*='_release_']")`

Here are [more wildcards](https://stackoverflow.com/a/8714421/1451422) if you need a different reaction.

```js
console.dir(document.querySelectorAll("[id*='_release_']"))
```

```html
<div class="sect2">
  <h3 id="_release_8_3">Release 8.3</h3>
  <div class="sect3">
    <h4 id="_qa_test_release_1_2_4_to_take_a_look_at_manifest">QA TEST release 1.2.4 (to take a look at manifest)</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-1.2.4.html">Release Manifest</a></p>
        </li>
      </ul>
    </div>
  </div>
  <div class="sect3">
    <h4 id="_qa_test_release_1_2_3_to_take_a_look_at_manifest">QA TEST release 1.2.3 (to take a look at manifest)</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-1.2.3.html">Release Manifest</a></p>
        </li>
      </ul>
    </div>
  </div>
  <div class="sect3">
    <h4 id="_qa_release_8_3_1">QA release 8.3.1</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-8.2.6.html">Release Manifest</a></p>
        </li>
        <li>
          <p>Bugs <a href="link">fixed in this release</a></p>
        </li>
        <li>
          <p>Package updates:</p>
          <div class="literalblock">
            <div class="content">
              <pre>user-portal 8.2</pre>
            </div>
          </div>
        </li>
        <li>
          <p>Database migration scripts to run:</p>
          <div class="literalblock">
            <div class="content">
              <pre>none</pre>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</div>
<div class="sect2">
  <h3 id="_release_8_2">Release 8.2</h3>
  <div class="sect3">
    <h4 id="_qa_test_release_1_2_4_to_take_a_look_at_manifest_2">QA TEST release 1.2.4 (to take a look at manifest)</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-1.2.4.html">Release Manifest</a></p>
        </li>
      </ul>
    </div>
  </div>
  <div class="sect3">
    <h4 id="_qa_test_release_1_2_3_to_take_a_look_at_manifest_2">QA TEST release 1.2.3 (to take a look at manifest)</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-1.2.3.html">Release Manifest</a></p>
        </li>
      </ul>
    </div>
  </div>
  <div class="sect3">
    <h4 id="_qa_release_8_2_6">QA release 8.2.6</h4>
    <div class="ulist">
      <ul>
        <li>
          <p><a href="release-manifest-8.2.6.html">Release Manifest</a></p>
        </li>
        <li>
          <p>Bugs <a href="link">fixed in this release</a></p>
        </li>
        <li>
          <p>Package updates:</p>
          <div class="literalblock">
            <div class="content">
              <pre>user-portal 8.2</pre>
            </div>
          </div>
        </li>
        <li>
          <p>Database migration scripts to run:</p>
          <div class="literalblock">
            <div class="content">
              <pre>none</pre>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</div>
```
e.g. \_release\_8\_3

```
var string = 'release';
var number1 = 8;
var number2 = 3;
var selector = '#_'+ [ string, number1, number2 ].join( '_' );

var element = $(selector);
    element = document.querySelector(selector);
    element = document.getElementById('_'+ [ string, number1, number2 ].join( '_' ) );

```

Have you tried any of these?

If instead you are wanting to find all ids that match a pattern, use a class instead. You can do pattern matching in lookups, however it is less performant and javascript will have to examine every single element in the dom to see if it matches your attribute pattern. Instead by giving like patterned id elements the same class, you can perform a class lookup which, along with id and tagName lookups, are some of the fastest lookups your browser can perform.

Otherwise if you feel you absolutely must do this, I would instead try to steer you towards using one of the more efficient selectors, and then using filter to find what you want. For instance in your example it looks like the pattern you gave is associated with h3 elements, so you could do.

```
$('h3').filter(function(){
    return /^[_]release[_][0-9]+[_][0-9]+$/.test(this.id);
});

```

Provided I got my regex right, this would find all the h3 elements and then filter to return only those that match the pattern `_release_#_#` where # is any number