var $mId, $mSynonyms, $mCaseSensitive;
var $mRegex = '';
var $mRegexStart = '';
+ var $mRegexStartToEnd = '';
var $mBaseRegex = '';
var $mVariableRegex = '';
var $mVariableStartToEndRegex = '';
'contentlanguage',
'numberofadmins',
'numberofviews',
+ 'cascadingsources',
);
/* Array of caching hints for ParserCache */
$case = $this->mCaseSensitive ? '' : 'iu';
$this->mRegex = "/{$this->mBaseRegex}/{$case}";
$this->mRegexStart = "/^(?:{$this->mBaseRegex})/{$case}";
+ $this->mRegexStartToEnd = "/^(?:{$this->mBaseRegex})$/{$case}";
$this->mVariableRegex = str_replace( "\\$1", "(.*?)", $this->mRegex );
$this->mVariableStartToEndRegex = str_replace( "\\$1", "(.*?)",
"/^(?:{$this->mBaseRegex})$/{$case}" );
return $this->mRegexStart;
}
+ /**
+ * Gets a regex matching the word from start to end of a string
+ *
+ * @return string
+ * @since 1.23
+ */
+ function getRegexStartToEnd() {
+ if ( $this->mRegexStartToEnd == '' ) {
+ $this->initRegex();
+ }
+ return $this->mRegexStartToEnd;
+ }
+
/**
* regex without the slashes and what not
*
return (bool)preg_match( $this->getRegexStart(), $text );
}
+ /**
+ * Returns true if the text matched the word
+ *
+ * @param $text string
+ *
+ * @return bool
+ * @since 1.23
+ */
+ function matchStartToEnd( $text ) {
+ return (bool)preg_match( $this->getRegexStartToEnd(), $text );
+ }
+
/**
* Returns NULL if there's no match, the value of $1 otherwise
* The return code is the matched string, if there's no variable
}
/**
- * @param $text
+ * @param $text
* @return bool
*/
function matchStartAndRemove( &$text ) {