title: Use Regular expression in JSX file in (React + Material-ui)
body: <p>I am trying to use RegEx to do material-ui form based validation. I am using my JS based Regex, but it does not work. Why ? </p>
  
  <p>Below is the snippet from my template.jsx file. my-form is just a wrapper on the formsy material-ui component.</p>
  
  <pre><code>import {myForm, TextField} from '@react-component/my-form';
  
  export default (props) =&gt; {
   } = props;
     const emailRegex = new RegExp('/\S+@\S+\.\S+/');
      const phoneRegEx = new RegExp('/^[(]{0,1}[0-9]{3}[)]{0,1}[-\s\.]{0,1}[0-9]{3}[-/\s\.]{0,1}[0-9]{4}$/');
      return (
  &lt;myForm&gt;
    &lt;TextField id="smsNumber" value={userInfo.smsNumber} name="smsNumberName" required requiredError="Mobile is a required field." validations={{matchRegexp:phoneRegEx}} validationErrors={{matchRegexp:'Enter a valid mobile.'}} onChange={changeSmsNumber} floatingLabelText={t('userProfile.mobile', "Mobile")} floatingLabelFixed={true} hintText={t('userProfile.mobile', "Mobile")}/&gt;
  &lt;/myForm&gt;
     );
  };
  </code></pre>
  
  <p>This code always gives 'Enter a valid Mobile' error message. </p>