<p>I'm increasingly becoming aware that there must be major differences in the ways that regular expressions will be interpreted by browsers.<br />
As an example, a co-worker had written this regular expression, to validate that a file being uploaded would have a PDF extension:</p>

<pre><code>^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.pdf)$
</code></pre>

<p>This works in Internet Explorer, and in Google Chrome, but does NOT work in Firefox.  The test always fails, even for an actual PDF.  So I decided that the extra stuff was irrelevant and simplified it to:</p>

<pre><code>^.+\.pdf$
</code></pre>

<p>and now it works fine in Firefox, as well as continuing to work in IE and Chrome.<br />
Is this a quirk specific to asp:FileUpload and RegularExpressionValidator controls in ASP.NET, or is it simply due to different browsers supporting regex in different ways?  Either way, what are some of the latter that you've encountered?</p>

If you're using javascript, not enclosing the regex with slashes causes error in Firefox.
Try doing
```
var regex = /^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.pdf)$/;
```