title: How to combine two patterns in Dart?
body: <p>In Dart, a <code>Pattern</code> is &quot;an interface for basic searches within strings&quot; as it says in the doc.</p>
  <p>I wanted to combine two <code>Pattern</code>s like so:</p>
  <pre><code>const Pattern REGEX_DATETIME_WITHOUT_TIMEZONE = r'\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.(\d{3}|\d{6}))?';
  const Pattern REGEX_DATETIME_WITH_TIMEZONE = r'$REGEX_DATETIME_WITHOUT_TIMEZONE[+-]\d{2}:\d{2}';
  </code></pre>
  <p>But that <code>$</code> syntax to inject variables cannot be used in <code>Pattern</code>s. So which would be the most reasonable way to achieve this?</p>