WordPress Version: 6.2
/**
* Handles parsing errors in `wp_kses_hair()`.
*
* The general plan is to remove everything to and including some whitespace,
* but it deals with quotes and apostrophes as well.
*
* @since 1.0.0
*
* @param string $attr
* @return string
*/
function wp_kses_html_error($attr)
{
return preg_replace('/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $attr);
}