title: Regex with predefined start and end pattern
body: <p>My regex pattern must start with /* and must end with */; between this it might contain all alphabets, numbers, special characters - zero or more times. </p>
  
  <p>I have made the following regex expression for this: </p>
  
  <pre><code> [/*][a-zA-Z0-9~@#\^\$&amp;\*\(\)-_\+=\[\]\{\}\|\\,\.\?\s]*[*/;]
  </code></pre>
  
  <p>But this expression does not show error for patterns such as: </p>
  
  <ol>
  <li>/* </li>
  <li>/ * sdfsdff</li>
  <li>/* sdfsfeff *</li>
  <li>/* fefef3323 */</li>
  </ol>
  
  <p>Which is wrong. It must start with /* and end with */; at any cost. </p>
  
  <p>Following is angular code for testing this pattern. Pls someone help out! </p>
  
  <p>CODE: </p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js" &gt;&lt;/script&gt; 
          &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular-messages.min.js"&gt;&lt;/script&gt; 
  &lt;/head&gt;
  
  &lt;body ng-app="myApp" ng-controller="myCtrl"&gt;
  
  &lt;form name="form1" novalidate&gt;
      {{form1.age.$error}}
      &lt;input type="text" name="age" ng-model="myAge" ng-pattern="/^[/*][a-zA-Z0-9~@#\^\$&amp;\*\(\)-_\+=\[\]\{\}\|\\,\.\?\s]*[*/;]$/" /&gt;
      &lt;div ng-messages="form1.age.$error" &gt;
          &lt;span ng-message="pattern"&gt;This field has wrong pattern.&lt;/span&gt;
      &lt;/div&gt;
  &lt;/form&gt; 
  
  &lt;script&gt;
  //module declaration
  var app = angular.module("myApp",['ngMessages']);
  //controller declaration
  app.controller('myCtrl',function($scope){
      //code goes here ... 
  });
  &lt;/script&gt; 
  
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Reference:</strong> </p>
  
  <p><a href="https://stackoverflow.com/questions/10173460/regular-expression-include-and-exclude-special-characters">Regular expression include and exclude special characters</a></p>
  
  <p><a href="http://www.regular-expressions.info/repeat.html" rel="nofollow noreferrer">http://www.regular-expressions.info/repeat.html</a></p>