From e1052e2eb37c2899d9876690d08e7ac094f6fe35 Mon Sep 17 00:00:00 2001 From: Jon McPartland Date: Thu, 25 Oct 2018 14:30:47 +0100 Subject: [PATCH] Add documentation to hashtag regex --- ...liveblog-entry-extend-feature-hashtags.php | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/classes/class-wpcom-liveblog-entry-extend-feature-hashtags.php b/classes/class-wpcom-liveblog-entry-extend-feature-hashtags.php index b1baffccb..f9a051207 100644 --- a/classes/class-wpcom-liveblog-entry-extend-feature-hashtags.php +++ b/classes/class-wpcom-liveblog-entry-extend-feature-hashtags.php @@ -39,8 +39,31 @@ public function load() { // the generated hashtag class. $this->class_prefix = apply_filters( 'liveblog_hashtag_class', $this->class_prefix ); - // Set a better regex for hashtags to allow for hex values in content. - $this->set_regex( '~(?:(??)(?:(?get_prefixes() ) . ')([0-9_\-\p{L}]*))~um' ); + $prefixes = implode( '|', $this->get_prefixes() ); + + // Set a better regex for hashtags to allow for hex values in content -- see https://regex101.com/r/CLWsCo/ + // phpcs:disable Squiz.Strings.ConcatenationSpacing.PaddingFound -- ignore indentation + $this->set_regex( + '~' + . '(?:' + . '(??' // possible right angle bracket(s) + . ')' + . '(?:' + . '(?