title: Is regex too slow? Real life examples where simple non-regex alternative is better
body: <p>I've seen people here made comments like "regex is too slow!", or "why would you do something so simple using regex!" (and then present a 10+ lines alternative instead), etc.</p>
  
  <p>I haven't really used regex in industrial setting, so I'm curious if there are applications where regex is demonstratably just too slow, <strong>AND</strong> where a <em>simple</em> non-regex alternative exists that performs significantly (maybe even asymptotically!) better.</p>
  
  <p>Obviously many highly-specialized string manipulations with sophisticated string algorithms will outperform regex easily, but I'm talking about cases where a simple solution exists and <em>significantly</em> outperforms regex.</p>
  
  <p>What counts as simple is subjective, of course, but I think a reasonable standard is that if it uses only <code>String</code>, <code>StringBuilder</code>, etc, then it's probably simple.</p>
  
  <hr>
  
  <p><em>Note</em>: I would very much appreciate answers that demonstrate the following:</p>
  
  <ol>
  <li>a beginner-level regex solution to a non-toy real-life problem that performs horribly</li>
  <li>the simple non-regex solution</li>
  <li>the expert-level regex rewrite that performs comparably</li>
  </ol>