title: How do I find and select a next bold word
body: <p>From the <a href="https://gist.github.com/oshliaer/d468759b3587cfb424348fa722765187" rel="nofollow">https://gist.github.com/oshliaer/d468759b3587cfb424348fa722765187</a> , It is possible to select a particular word from the findText, I want to implement the same for bold words only</p>
  
  <p>I have a function to find bold. How do I modify the above gist?</p>
  
  <pre><code>var startFlag = x;
  var flag = false;
  
  for (var i = x; i &lt; y; i++) {
      if (text.isBold(i) &amp;&amp; !flag) {
          startFlag = i;
          flag = true;
      } else if (!text.isBold(i) &amp;&amp; flag) {
          flag = false;
          rangeBuilder.addElement(text, startFlag, i - 1);
          doc.setSelection(rangeBuilder.build());
          return;
      }
  }
  if (flag) {
      rangeBuilder.addElement(text, startFlag, i - 1);
      doc.setSelection(rangeBuilder.build());
      return;
  }
  </code></pre>