/**
* Computes a regular expression for matching a wildcard attribute name.
*
* @param string $wildcard_attribute_name
* The wildcard attribute name for which to compute a regular expression.
*
* @return string
* The computed regular expression.
*/
private static function getRegExForWildCardAttributeName(string
$wildcard_attribute_name): string
{ assert(self::
isWildcardAttributeName($wildcard_attribute_name));
return '/^' .
str_replace('*', '.*',
$wildcard_attribute_name) . '$/';
} /**
* Gets the subset of allowed elements whose tags are wildcards.
*
* @return \Drupal\ckeditor5\HTMLRestrictions
* The subset of the given set of HTML restrictions.
*/
public function getWildcardSubset(): HTMLRestrictions
{ return new self(array_filter($this->elements,
[__CLASS__, 'isWildcardTag'
], ARRAY_FILTER_USE_KEY
));
}