title: Generating RegEx pattern for a given string
body: <p>I need to generate a RegEx pattern for a file name validation. But I am not used to RegEx pattern. I did try to generate patterns by using think <a href="https://regexr.com/" rel="nofollow noreferrer">link</a>. I generated a pattern <code>(^.*$)|(^.*i.*$)</code> but it is not working as desired and got new pattern <code>^\d+(?:_[A-Za-z]+)?$</code> from an answer but some new conditions are required which I have listed below.</p>
  <p>My required validations are as follows :</p>
  <ul>
  <li>1234567890 =&gt; Valid</li>
  <li>1234567890_Alphabet =&gt; Valid, '_' symbol is valid, other symbol as well as white space characters are invalid.</li>
  <li>1234567890 - Alphabet =&gt; Invalid</li>
  <li>1234567890alphabet =&gt; Invalid</li>
  </ul>
  <p>New conditions :</p>
  <ul>
  <li>11244422_134444_john =&gt; Valid</li>
  <li>1234322_1234431 john =&gt; Invalid</li>
  <li>1234222_134322-john =&gt; Invalid</li>
  <li>12422344_12453222 =&gt; Valid</li>
  </ul>
  <p>Some other validations :</p>
  <ul>
  <li>The string should start as numeric but not alphabet. i.e. Numeric only</li>
  <li>Underscore(_) preceded by numbers.</li>
  </ul>