title: Select some string from sentence
body: <p>I am new to regex and would like to select some string following rule:</p>
  
  <blockquote>
    <p>Select "beautiful"(zero or one) and "people00" or "peopleXXX" if matched.</p>
  </blockquote>
  
  <p>sentence:</p>
  
  <ol>
  <li>"I am beautiful, charming and friendly people00"</li>
  <li>"I am beautiful, charming and friendly peopleXXX"</li>
  <li>"I am charming and friendly people00"</li>
  <li>"I am charming and friendly peopleXXX"</li>
  </ol>
  
  <p>Now I use below rule to get two string</p>
  
  <pre><code>(?i)(beautiful| ).*(people[a-zA-Z0-9]{2,3})
  </code></pre>
  
  <p>Is there another ways to select it?</p>
  
  <p>I tried to directly use <code>(beautiful)?.*(people[a-zA-Z0-9]{2,3})</code> but it does not work.</p>