private function validate($regex): void {
    if(@preg_match($regex, '') === false) {
      throw new InvalidArgumentException('Expected regex, but got [' . var_export($regex, true) . '] instead');
    }
  }
private function validate($regex): void {
    if(@preg_match($regex, '') === false) {
      throw new InvalidArgumentException('Expected regex, but got [' . var_export($regex, true) . '] instead');
    }
  }
private function validate ( $ regex ) : void { if ( @ preg_match ( $ regex , '' ) === false ) { throw new InvalidArgumentException ( 'Expected regex, but got [' . var_export ( $ regex , true ) . '] instead' ) ; } }
Ensures the regex passed in is valid

@throws  InvalidArgumentException  If the value is not a valid regex

@param  string  $regex  The value to validate
Ensures the regex passed in is valid