original_string: public static function get_attribute($tag, $attrname, $type = PARAM_RAW) {
          if (preg_match('/^<[^>]*\b' . $attrname . '="(.*?)"/is', $tag, $matches)) {
              return clean_param(htmlspecialchars_decode($matches[1]), $type);
          } else if (preg_match('~^<[^>]*\b' . $attrname . '[ />]"~is', $tag, $matches)) {
              // Some attributes may not have value, for example this is valid: <video controls>.
              return clean_param("true", $type);
          }
          return null;
      }
code: public static function get_attribute($tag, $attrname, $type = PARAM_RAW) {
          if (preg_match('/^<[^>]*\b' . $attrname . '="(.*?)"/is', $tag, $matches)) {
              return clean_param(htmlspecialchars_decode($matches[1]), $type);
          } else if (preg_match('~^<[^>]*\b' . $attrname . '[ />]"~is', $tag, $matches)) {
              // Some attributes may not have value, for example this is valid: <video controls>.
              return clean_param("true", $type);
          }
          return null;
      }
code_tokens: public static function get_attribute ( $ tag , $ attrname , $ type = PARAM_RAW ) { if ( preg_match ( '/^<[^>]*\b' . $ attrname . '="(.*?)"/is' , $ tag , $ matches ) ) { return clean_param ( htmlspecialchars_decode ( $ matches [ 1 ] ) , $ type ) ; } else if ( preg_match ( '~^<[^>]*\b' . $ attrname . '[ />]"~is' , $ tag , $ matches ) ) { // Some attributes may not have value, for example this is valid: <video controls>. return clean_param ( "true" , $ type ) ; } return null ; }
docstring: Extracts a value for an attribute
  
  @param string $tag html tag which properties are extracted, for example "<video ...>....</video>"
  @param string $attrname name of the attribute we are looking for
  @param string $type one of PARAM_* constants to clean the attribute value
  @return string|null
docstring_tokens: Extracts a value for an attribute