Merge "Use \h instead of \s in regular expressions"

This commit is contained in:
jenkins-bot 2018-10-11 22:11:58 +00:00 committed by Gerrit Code Review
commit 319789827c

View file

@ -3,7 +3,7 @@
use MediaWiki\MediaWikiServices;
abstract class EchoDiscussionParser {
const HEADER_REGEX = '^(==+)\s*([^=].*)\s*\1$';
const HEADER_REGEX = '^(==+)\h*([^=].*)\h*\1$';
static protected $timestampRegex;
static protected $revisionInterpretationCache = [];
@ -1144,7 +1144,7 @@ abstract class EchoDiscussionParser {
// Step 2: Generalise it
// Trim off the timezone to replace at the end
$output = $exemplarTimestamp;
$tzRegex = '/\s*\(\w+\)\s*$/';
$tzRegex = '/\h*\(\w+\)\h*$/';
$tzMatches = [];
if ( preg_match( $tzRegex, $output, $tzMatches ) ) {
$output = preg_replace( $tzRegex, '', $output );