<p dir="auto"><strong>I'm submitting a feature request</strong></p>
<p dir="auto"><strong>Current behavior</strong><br>
Now We can only pass strings to directive. And sometimes it is quite hard to test becouse you need to escape it and IDEs dont test it on fly.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong><br>
Here <a href="https://plnkr.co/edit/PIpQqCqp8pwKJD8g63Ha?p=preview" rel="nofollow">plank</a> that shows the problem</p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong><br>
Better code mantaining</p>
<ul dir="auto">
<li><strong>Angular version:</strong> 2.0.3</li>
</ul>
<p dir="auto">Thank you.</p>
<p dir="auto"><strong>I'm submitting a ...</strong>  (check one with "x")</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[* ] bug report
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[* ] bug report
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
Here's how I'm building a form input field<br>
Regular expression pattern:<br>
regexPattern:string  is "/^\d{2}/\d{2}/\d{4}$/"</p>
<p dir="auto">group[question.key] = ['', Validators.compose([Validators.required,Validators.pattern(regexPattern)])];<br>
FormBuilder.group(group)</p>
<p dir="auto">During Debugging I see:<br>
regexPattern : "/^d{2}/d{2}/d{4}$/"<br>
{ "pattern": { "requiredPattern": "^/^d{2}/d{2}/d{4}$/$", "actualValue": "01/01/2001" } }</p>
<p dir="auto"><strong>Expected/desired behavior</strong><br>
As you can see the requiredPattern adds an extra ^ at the beginning and a $ at the end. Validators.pattern(String) should accept a Regexp not a String. The regexPattern set was "/^\d{2}/\d{2}/\d{4}$/" but as you can see it's value while debugging is obvsiously requiredPattern": "^/^d{2}/d{2}/d{4}$/$"</p>
<p dir="auto">Validators.patterns(String) should instead accept a regular expression literal Validators.pattern(RegExp). It should have  the same input signature as str.match(regexp) in javascript <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match</a></p>
<p dir="auto"><strong>Reproduction of the problem</strong><br>
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via <a href="https://plnkr.co" rel="nofollow">https://plnkr.co</a> or similar (you can use this template as a starting point: <a href="http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5" rel="nofollow">http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5</a>).</p>
<p dir="auto"><strong>What is the expected behavior?</strong></p>
<p dir="auto"><strong>What is the motivation / use case for changing the behavior?</strong></p>
<p dir="auto"><strong>Please tell us about your environment:</strong></p>
<ul dir="auto">
<li><strong>Angular version:</strong> 2.0.0-rc.4</li>
<li><strong>Browser:</strong> [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]</li>
<li><strong>Language:</strong> [TypeScript X.X]</li>
</ul>