original_string: public function rule_regex($a)
      {
          $opt = array();
          $rule = $this->pullRule();
          if ($rule[0] != '/') {
              $rule = '/^'.$rule.'*$/';
          }
          $opt['regexp'] = $rule;
  
          if (!filter_var($a, FILTER_VALIDATE_REGEXP, ['options' => $opt])) {
              return $this->fail('does not match the pattern');
          }
      }
code: public function rule_regex($a)
      {
          $opt = array();
          $rule = $this->pullRule();
          if ($rule[0] != '/') {
              $rule = '/^'.$rule.'*$/';
          }
          $opt['regexp'] = $rule;
  
          if (!filter_var($a, FILTER_VALIDATE_REGEXP, ['options' => $opt])) {
              return $this->fail('does not match the pattern');
          }
      }
code_tokens: public function rule_regex ( $ a ) { $ opt = array ( ) ; $ rule = $ this -> pullRule ( ) ; if ( $ rule [ 0 ] != '/' ) { $ rule = '/^' . $ rule . '*$/' ; } $ opt [ 'regexp' ] = $ rule ; if ( ! filter_var ( $ a , FILTER_VALIDATE_REGEXP , [ 'options' => $ opt ] ) ) { return $ this -> fail ( 'does not match the pattern' ) ; } }
docstring: Requires a regex pattern as the
  next rule in the chain.
  
  Please give your rule a custom error message.
docstring_tokens: Requires a regex pattern as the next rule in the chain .