title: Pass custom parameters in Laravel Validation with regex
body: <p>Okay, I've got in a very difficult situation here and I think I'm either missing on something crucial that's already present or Laravel doesn't provide a way to achieve that as of right now. 
  I'd like to specify a custom validation error message with a custom placeholder I'd like to replace in the message. The problem with that: I'm using the <code>regex</code> validation rule, about which <a href="https://laravel.com/docs/5.6/validation#rule-regex" rel="nofollow noreferrer">Laravel documentation</a> explicitly points out, that it should be better passed in an array to avoid unwanted separator behavior. The situation is the following: I'd like to specify a global multilingual message for validating <code>name.regex</code>, which I've done so:</p>
  
  <pre><code>'custom' =&gt; [
      'name' =&gt; [
          'regex' =&gt; 'The :attribute must corespond to the given format: :format!'
      ]
  ]
  </code></pre>
  
  <p>As you can see, I've put a custom placeholder <code>:format</code> in that message, because for the <code>name</code> attribute of different classes I'm going to be matching different regular expressions. So I'd like to be able to input a custom human readable description of each given regex along the validation (as a parameter).
  So I'm doin the following in my controller:</p>
  
  <pre><code>$input = Input::all();
  $validator = Validator::make($input, [
          'name' =&gt; ['required', 'regex:/^\p{Lu}\p{L}+ \p{Lu}\p{L}+$/u']
      ]);
  </code></pre>
  
  <p>I've also got a <code>Validator::replacer()</code> method in my <code>AppServiceProvider.php</code> which should replace the <code>:format</code> placeholder in the message:</p>
  
  <pre><code>Validator::replacer('regex', function($message, $attr, $rule, $parameters){
          return str_replace(':format', "I would like to be able to somehow retrieve the custom format description here, but using \$parameters[] is not an option", $message);
      });
  </code></pre>
  
  <p>The problem with the <code>regex</code> validation rule is that I'm really not allowed to pass a parameter to it in the validator, like for example so:</p>
  
  <pre><code>$validator = Validator::make($input, [
          'name' =&gt; ['required', 'regex:/^\p{Lu}\p{L}+ \p{Lu}\p{L}+$/u,Thats my custom validator format description']
      ]);
  </code></pre>
  
  <p>because it completely messes up the regular expression (which should be that way). So I can't user $parameters<a href="https://laravel.com/docs/5.6/validation#rule-regex" rel="nofollow noreferrer">1</a>$ in my <code>replacer()</code> to replace the placeholder. Furthermore it would be really inconvenient to have to pass a whole sentence as a comma-separated parameter of a validation rule. So that concept doesn't fit the needs.</p>
  
  <p>The <code>:format</code> value will be dynamic and will severely vary throughout different classes' <code>name</code> fields requirements, so I really need that dynamic multilingual description to be set as a property of the current validator instance. I thought maybe the most convenient scenario would be the something like this:</p>
  
  <pre><code>$validator = Validator::make($input, [
          'name' =&gt; ['required', 'regex:/^\p{Lu}\p{L}+ \p{Lu}\p{L}+$/u', 'format:Current name requirements described here.']
      ]);
  </code></pre>
  
  <p>and Laravel somehow knows that <code>:format</code> should be replaced by the present rule somewhere in the messages of that instance. I thought about explicitly adding this additional parameter as a validation rule and later on manage it, but I'm really unable to achieve the cross-rule connection (in other words, to get the parameter of the new <code>format</code> rule and use it in the <code>regex</code> rule). 
  I really don't know how to approach that issue and any help would be greatly appreciated. Thanks in advance!</p>
  
  <p>P.S. I'm aware I could specify the whole message each time this way:</p>
  
  <pre><code>$input = Input::all();
  $validator = Validator::make($input, [
          'name' =&gt; ['required', 'regex:/^\p{Lu}\p{L}+ \p{Lu}\p{L}+$/u']
      ],
  [
      'name.regex' =&gt; 'My custom message here'
  ]);
  </code></pre>
  
  <p>but I don't want to have to input the whole message each time, because it might later on contain other placeholders (that might be global or so) in it and I want to use the multilingual base message provided via the <code>validator.php</code> files, so I really need to replace the <code>:format</code> only.</p>