* Add a getRegexCase() accessor for getting i or nothing depending on the
authorÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 05:35:03 +0000 (05:35 +0000)
committerÆvar Arnfjörð Bjarmason <avar@users.mediawiki.org>
Sun, 8 Jan 2006 05:35:03 +0000 (05:35 +0000)
  case-insensitiveness of the thing, only needed with getBaseRegex() since that
  won't include it automatically..

includes/MagicWord.php

index 87a332b..2c09165 100644 (file)
@@ -198,6 +198,18 @@ class MagicWord {
                return $this->mRegex;
        }
 
+       /**
+        * Gets the regexp case modifier to use, i.e. i or nothing, to be used if
+        * one is using MagicWord::getBaseRegex(), otherwise it'll be included in
+        * the complete expression
+        */
+       function getRegexCase() {
+               if ( $this->mRegex === '' )
+                       $this->initRegex();
+
+               return $this->mCaseSensitive ? '' : 'i';
+       }
+
        /**
         * Gets a regex matching the word, if it is at the string start
         */