title: preg_match(): No ending delimiter '/' found Laravel
body: <p>I'm doing a validation by regex from a request, this validation is to check that the parameter that is sent is an IP.</p>
  
  <p>My rules are as follows:</p>
  
  <pre><code>  &lt;?php
  
  namespace App\Http\Requests\usuarios;
  
  use Illuminate\Foundation\Http\FormRequest;
  
  class storeVPN extends FormRequest
  {
      /**
       * Determine if the user is authorized to make this request.
       *
       * @return bool
       */
      public function authorize()
      {
          return true;
      }
  
      /**
       * Get the validation rules that apply to the request.
       *
       * @return array
       */
      public function rules()
      {
          return [            
              'segmentwan' =&gt; 'regex:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',
              'segmentlan' =&gt; 'regex:/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/',
  
          ];
      }
  </code></pre>
  
  <p>the debugger shows me that the error is in this line</p>
  
  <p>the debugger shows me that the error is in this line</p>
  
  <pre><code>return preg_match($parameters[0], $value) &gt; 0;
  </code></pre>
  
  <p>y el error completo es el siguiente</p>
  
  <pre><code> * @return bool
       */
      public function validateRegex($attribute, $value, $parameters)
      {
          if (! is_string($value) &amp;&amp; ! is_numeric($value)) {
              return false;
          }
  
          $this-&gt;requireParameterCount(1, $parameters, 'regex');
  
          return preg_match($parameters[0], $value) &gt; 0;
      }
  
      /**
       * Validate that a required attribute exists.
       *
       * @param  string  $attribute
       * @param  mixed   $value
       * @return bool
       */
      public function validateRequired($attribute, $value)
      {
          if (is_null($value)) {
              return false;
          } elseif (is_string($value) &amp;&amp; trim($value) === '') {
              return false;
          } elseif ((is_array($value) || $value instanceof Countable) &amp;&amp; count($value) &lt; 1) {
              return false;
          } elseif ($value instanceof File) {
              return (string) $value-&gt;getPath() !== '';
          }
  </code></pre>