Email format validation in mvc3 view

In a View in MVC3 I want to make a jquery function which validates a textbox for an email format, but when I want to write it like this:

var a = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?";

It doesn't work, because MVC thinks @(...) its a Razor code.

How can I do it ?


Razor allows you to enter this by typing in double @. Try @@


@Html.Raw(" var a = "[a-z0-9....")


  • Database field containing HTML display raw text
  • MVC's AllowAnonymousAttribute not showing up
  • The name 'ViewData' does not exist in the current context
  • How to filter local requests in asp.net web api?
  • Mongoid same embedded documents types for different fields
  • Handling null values with wso2 CEP
  • File path validation in javascript
  • c# How to detect and process a .URL file type on DragDrop event
  • Zend Framework 2 - Building a simple form with Validators
  • How to make Javascript generated checkboxes persist?
  • ASP.NET RegularExpressionValidator, validate on a non-match?
  • How to save dynamically created textboxes and their values
  • Regex for URL rewrite with optional query string parameters
  • Regex to match a string not followed by anything
  • How to add a focus style to an editable ComboBox in WPF
  • Login not working in Firefox in Meteor
  • How do I access an unhandled exception in an MVC Error view?
  • Email verification using google app script and google forms
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • How to add date and time under each post in guestbook in google app engine
  • javascript inside java/jsp code
  • sending/ receiving email in Java
  • Font Awesome Showing Box instead of Icons
  • jQuery tmpl and DataLink beta
  • Properly structure and highlight a GtkPopoverMenu using PyGObject
  • Cannot Parse HTML Data Using Android / JSOUP
  • How to disable jQuery.jplayer autoplay?
  • How to delete a row from a dynamic generate table using jquery?
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • using HTMLImports.whenReady not working in chrome
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • coudnt use logback because of log4j
  • Getting Messege Twice Using IMvxMessenger
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • Authorize attributes not working in MVC 4
  • Is it possible to post an object from jquery to bottle.py?
  • EntityFramework adding new object to nested object collection
  • Python/Django TangoWithDjango Models and Databases
  • How to load view controller without button in storyboard?