Regular Expressions 101

Save & Share

  • Current Version: 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
Processing...

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "(?m)[^#]wfLoadExtension\(\s*'(?<name>\S+)'\s*\);(?<comment>[^\n]*)\n" Local $sString = "# Protect against web entry" & @CRLF & _ "if ( !defined( 'MEDIAWIKI' ) ) {" & @CRLF & _ " exit;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "#Debug Settings" & @CRLF & _ "if ( getenv( 'MW_SHOW_EXCEPTION_DETAILS' ) === 'true' ) {" & @CRLF & _ "# error_reporting( -1 );" & @CRLF & _ "# ini_set( 'display_errors', 1 );" & @CRLF & _ "# $wgShowExceptionDetails = true;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "########################### Core Settings ##########################" & @CRLF & _ "#local time zone" & @CRLF & _ "# we have to use "UTC" here, otherwise SMW stores time values with reference to the local time zone" & @CRLF & _ "# see also: https://www.semantic-mediawiki.org/wiki/Help:Type_Date" & @CRLF & _ "$wgLocaltimezone = "UTC";" & @CRLF & _ "#$wgLocaltimezone = getenv( 'MW_TIME_ZONE' );" & @CRLF & _ "# instead we store the timezone param as default user timezone setting" & @CRLF & _ "# the offset is dynamically calculated, e.g. 'ZoneInfo|120|Europe/Berlin';" & @CRLF & _ "date_default_timezone_set('UTC');" & @CRLF & _ "$wgDefaultUserOptions['timecorrection'] = 'ZoneInfo|' " & @CRLF & _ " . timezone_offset_get(" & @CRLF & _ " new DateTimeZone( getenv( 'MW_TIME_ZONE' ) ), " & @CRLF & _ " new DateTime( 'now', new DateTimeZone( getenv( 'MW_TIME_ZONE' ) ) )" & @CRLF & _ " ) / 60" & @CRLF & _ " . '|' . getenv( 'MW_TIME_ZONE' );" & @CRLF & _ "" & @CRLF & _ "# Site language code, should be one of the list in ./languages/Names.php" & @CRLF & _ "# we have to use 'en' here for technical reasons (namespace and smw property names)" & @CRLF & _ "$wgLanguageCode = 'en';" & @CRLF & _ "# instead, we set the lang param as default user interface lang" & @CRLF & _ "# see also: https://www.mediawiki.org/wiki/Manual:$wgDefaultUserOptions" & @CRLF & _ "$wgDefaultUserOptions['language'] = getenv( 'MW_SITE_LANG' );" & @CRLF & _ "" & @CRLF & _ "# we have to override the options loading to apply our defaults" & @CRLF & _ "# https://www.mediawiki.org/wiki/Manual_talk:$wgDefaultUserOptions#Setting_$wgDefaultUserOptions['language']_=_'de';_fails" & @CRLF & _ "$wgHooks['LoadUserOptions'][] = function( $user, array &$options ) use ($wgDefaultUserOptions) {" & @CRLF & _ " # lookup explicite user settings" & @CRLF & _ " $dbr = wfGetDB( DB_MASTER );" & @CRLF & _ " $res = $dbr->select(" & @CRLF & _ " 'user_properties'," & @CRLF & _ " [ 'up_property', 'up_value' ]," & @CRLF & _ " [ 'up_user' => $user->getId() ]," & @CRLF & _ " );" & @CRLF & _ " $data = [];" & @CRLF & _ " foreach ( $res as $row ) {" & @CRLF & _ " if ( $row->up_value === '0' ) {" & @CRLF & _ " $row->up_value = 0;" & @CRLF & _ " }" & @CRLF & _ " $data[$row->up_property] = $row->up_value;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " # apply default timezone if not set" & @CRLF & _ " if (!array_key_exists('timecorrection', $data)) $options['timecorrection'] = $wgDefaultUserOptions['timecorrection'];" & @CRLF & _ "" & @CRLF & _ " # apply default language if not set" & @CRLF & _ " //if (!array_key_exists('language', $data)) $options['language'] = $wgDefaultUserOptions['language']; // does not work with Extension:ULS, prevents changing the language via settings" & @CRLF & _ "};" & @CRLF & _ "" & @CRLF & _ "#$wgHooks['UserGetLanguageObject'][] = function( $user, &$code ) {" & @CRLF & _ "# $code = $user->getOption( 'language' );" & @CRLF & _ "#};" & @CRLF & _ "" & @CRLF & _ "## The protocol and server name to use in fully-qualified URLs => set in Custom settings" & @CRLF & _ "$wgServer = getenv( 'MW_SITE_SERVER' );" & @CRLF & _ "" & @CRLF & _ "# The name of the site. This is the name of the site as displayed throughout the site." & @CRLF & _ "$wgSitename = getenv( 'MW_SITE_NAME' );" & @CRLF & _ "" & @CRLF & _ "# Default skin: you can change the default skin. Use the internal symbolic" & @CRLF & _ "# names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector', 'chameleon':" & @CRLF & _ "wfLoadExtension( 'Bootstrap' );" & @CRLF & _ "$wgDefaultSkin = getenv( 'MW_DEFAULT_SKIN' );" & @CRLF & _ "$wgCitizenTableNowrapClasses[] = 'info_box'; # disable wrapping of info_box tables" & @CRLF & _ "$wgCitizenSearchGateway = "smwAskApi";" & @CRLF & _ "$wgCitizenSearchSmwApiAction = "compoundquery";" & @CRLF & _ "$wgCitizenSearchSmwAskApiQueryTemplate = "" & @CRLF & _ "[[HasNormalizedLabel::\${input_normalized}]][[HasOswId::!~*#*]];?HasLabel=displaytitle;?HasImage=thumbnail;?HasDescription=desc;limit=1" & @CRLF & _ "|[[HasNormalizedLabel::~*\${input_normalized_tokenized}*]][[HasOswId::!~*#*]];?HasLabel=displaytitle;?HasImage=thumbnail;?HasDescription=desc;limit=7" & @CRLF & _ "";" & @CRLF & _ "" & @CRLF & _ "# InstantCommons allows wiki to use images from http://commons.wikimedia.org" & @CRLF & _ "$wgUseInstantCommons = getenv( 'MW_USE_INSTANT_COMMONS' );" & @CRLF & _ "" & @CRLF & _ "# Name used for the project namespace. The name of the meta namespace (also known as the project namespace), used for pages regarding the wiki itself." & @CRLF & _ "#$wgMetaNamespace = 'Site'; #just an alias. does not work at all of canonical namespace 'project' is created / used by an extension" & @CRLF & _ "#$wgMetaNamespaceTalk = 'Site_talk';" & @CRLF & _ "" & @CRLF & _ "# The relative URL path to the logo. Make sure you change this from the default," & @CRLF & _ "# or else you'll overwrite your logo when you upgrade!" & @CRLF & _ "# logos should actually have different sizes, see https://www.mediawiki.org/wiki/Manual:$wgLogos" & @CRLF & _ "$wgLogos = [" & @CRLF & _ " '1x' => "$wgScriptPath/logo.png"," & @CRLF & _ " '1.5x' => "$wgScriptPath/logo.png"," & @CRLF & _ " '2x' => "$wgScriptPath/logo.png"," & @CRLF & _ " 'svg' => "$wgScriptPath/logo.svg"" & @CRLF & _ "];" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "# The URL of the site favicon (the small icon displayed next to a URL in the address bar of a browser)" & @CRLF & _ "$wgFavicon = "$wgScriptPath/favicon.ico";" & @CRLF & _ "" & @CRLF & _ "##### Short URLs" & @CRLF & _ "## https://www.mediawiki.org/wiki/Manual:Short_URL" & @CRLF & _ "$wgArticlePath = '/wiki/$1';" & @CRLF & _ "## Also see mediawiki.conf" & @CRLF & _ "" & @CRLF & _ "##### Improve performance" & @CRLF & _ "# https://www.mediawiki.org/wiki/Manual:$wgMainCacheType" & @CRLF & _ "switch ( getenv( 'MW_MAIN_CACHE_TYPE' ) ) {" & @CRLF & _ " case 'CACHE_ACCEL':" & @CRLF & _ " # APC has several problems in latest versions of MediaWiki and extensions, for example:" & @CRLF & _ " # https://www.mediawiki.org/wiki/Extension:Flow#.22Exception_Caught:_CAS_is_not_implemented_in_Xyz.22" & @CRLF & _ " $wgMainCacheType = CACHE_ACCEL;" & @CRLF & _ " $wgSessionCacheType = CACHE_DB; #This may cause problems when CACHE_ACCEL is used" & @CRLF & _ " break;" & @CRLF & _ " case 'CACHE_DB':" & @CRLF & _ " $wgMainCacheType = CACHE_DB;" & @CRLF & _ " break;" & @CRLF & _ " case 'CACHE_DB':" & @CRLF & _ " $wgMainCacheType = CACHE_DB;" & @CRLF & _ " break;" & @CRLF & _ " case 'CACHE_ANYTHING':" & @CRLF & _ " $wgMainCacheType = CACHE_ANYTHING;" & @CRLF & _ " break;" & @CRLF & _ " case 'CACHE_MEMCACHED':" & @CRLF & _ " # Use Memcached, see https://www.mediawiki.org/wiki/Memcached" & @CRLF & _ " $wgMainCacheType = CACHE_MEMCACHED;" & @CRLF & _ " $wgParserCacheType = CACHE_MEMCACHED; # optional" & @CRLF & _ " $wgMessageCacheType = CACHE_MEMCACHED; # optional" & @CRLF & _ " $wgMemCachedServers = explode( ',', getenv( 'MW_MEMCACHED_SERVERS' ) );" & @CRLF & _ " $wgSessionsInObjectCache = true; # optional" & @CRLF & _ " $wgSessionCacheType = CACHE_MEMCACHED; # optional" & @CRLF & _ " break;" & @CRLF & _ " default:" & @CRLF & _ " $wgMainCacheType = CACHE_NONE;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "#The path of the temporary directory. see https://www.mediawiki.org/wiki/Manual:$wgTmpDirectory" & @CRLF & _ "$wgTmpDirectory = $IP . '/images/temp';" & @CRLF & _ "$wgCacheDirectory = $IP . '/cache';" & @CRLF & _ "" & @CRLF & _ "########################### Search ############################" & @CRLF & _ "wfLoadExtension( 'Elastica' );" & @CRLF & _ "wfLoadExtension( 'CirrusSearch' );" & @CRLF & _ "$wgCirrusSearchServers = explode( ',', getenv( 'MW_CIRRUS_SEARCH_SERVERS' ) );" & @CRLF & _ "$wgSearchType = 'CirrusSearch';" & @CRLF & _ "" & @CRLF & _ "//manual fetch a property from the db and index it (does not work as expected)" & @CRLF & _ "/*$wgHooks['CirrusSearchBuildDocumentParse'][] = function( \Elastica\Document $doc, Title $title, Content $content, ParserOutput $parserOutput ) {" & @CRLF & _ " //fetch displaytitle from db" & @CRLF & _ " $dbr = wfGetDB( DB_REPLICA );" & @CRLF & _ " $displayTitle = $dbr->selectField(" & @CRLF & _ " 'page_props'," & @CRLF & _ " 'pp_value'," & @CRLF & _ " array( 'pp_propname' => 'displaytitle', 'pp_page' => $title->getArticleId() )," & @CRLF & _ " __METHOD__" & @CRLF & _ " );" & @CRLF & _ " if ( $displayTitle === null || trim($displayTitle) === '' )$doc_title = $title->getText();" & @CRLF & _ " else $doc_title = $displayTitle . ' ' . $title->getText();" & @CRLF & _ " //echo $doc_title . "\n";" & @CRLF & _ " //store displaytitle as title in elastic search document" & @CRLF & _ " $doc->set( 'display_title', $doc_title );" & @CRLF & _ " //$doc->set( 'title', $doc_title );" & @CRLF & _ "};*/" & @CRLF & _ "//$wgCirrusSearchPrefixSearchStartsWithAnyWord = true; //Is it ok if the prefix starts on any word in the title or just the first word?" & @CRLF & _ "//only in recent version of cirrus MW>1.35" & @CRLF & _ "#$wgCirrusSearchCustomPageFields = [" & @CRLF & _ "# 'display_title' => 'short_text'" & @CRLF & _ "#];" & @CRLF & _ "" & @CRLF & _ "//Register display_title as index" & @CRLF & _ "$wgHooks['SearchIndexFields'][] = function( array &$fields, SearchEngine $engine ) {" & @CRLF & _ " #$engine->Xtes();" & @CRLF & _ " if ( !( $engine instanceof CirrusSearch\CirrusSearch ) ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " $fields['display_title'] = $engine->makeSearchFieldMapping( 'display_title', 'short_text' );" & @CRLF & _ "};" & @CRLF & _ "" & @CRLF & _ "//rank display_title higher than title" & @CRLF & _ "$wgCirrusSearchWeights = [" & @CRLF & _ " 'title' => 20," & @CRLF & _ " 'display_title' => 50," & @CRLF & _ " 'redirect' => 15," & @CRLF & _ " 'category' => 8," & @CRLF & _ " 'heading' => 5," & @CRLF & _ " 'opening_text' => 3," & @CRLF & _ " 'text' => 1," & @CRLF & _ " 'auxiliary_text' => 0.5," & @CRLF & _ " 'file_text' => 0.5," & @CRLF & _ "];" & @CRLF & _ "$wgCirrusSearchPrefixWeights = [" & @CRLF & _ " 'title' => 10," & @CRLF & _ " 'display_title' => 30," & @CRLF & _ " 'redirect' => 1," & @CRLF & _ " 'title_asciifolding' => 7," & @CRLF & _ " 'redirect_asciifolding' => 0.7," & @CRLF & _ "];" & @CRLF & _ "" & @CRLF & _ "//allow fuzzy search and "do you mean" suggestions" & @CRLF & _ "//see also https://www.mediawiki.org/w/index.php?title=Topic:Wj3av65bti5a8v7o&topic_showPostId=wj6z0ty2ut72b3hw#flow-post-wj6z0ty2ut72b3hw" & @CRLF & _ "$wgCirrusSearchPhraseSuggestUseText = true;" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "//rebuild index with" & @CRLF & _ "/*" & @CRLF & _ "php /var/www/html/w/extensions/CirrusSearch/maintenance/UpdateSearchIndexConfig.php --startOver" & @CRLF & _ "php /var/www/html/w/extensions/CirrusSearch/maintenance/ForceSearchIndex.php" & @CRLF & _ "php /var/www/html/w/maintenance/runJobs.php" & @CRLF & _ "*/" & @CRLF & _ "" & @CRLF & _ "//alternative SMWSearch" & @CRLF & _ "#$wgSearchType = 'SMWSearch';" & @CRLF & _ "#$smwgFallbackSearchType = function() {" & @CRLF & _ "# return new CirrusSearch\CirrusSearch();" & @CRLF & _ "#};" & @CRLF & _ "// The two next parameters are recommended to highlight excerpts" & @CRLF & _ "#$smwgElasticsearchConfig['query']['highlight.fragment']['type'] = 'plain'; // or 'unified' or 'fvh'" & @CRLF & _ "#$smwgElasticsearchConfig['indexer']['raw.text'] = true;" & @CRLF & _ "" & @CRLF & _ "########################### VisualEditor ###########################" & @CRLF & _ "wfLoadExtension( 'VisualEditor' );" & @CRLF & _ "// Enable by default for everybody" & @CRLF & _ "$wgDefaultUserOptions['visualeditor-enable'] = 1;" & @CRLF & _ "// Use Visual editor in PageForms" & @CRLF & _ "wfLoadExtension( 'VEForAll' );" & @CRLF & _ "// Optional: Set VisualEditor as the default for anonymous users" & @CRLF & _ "// otherwise they will have to switch to VE" & @CRLF & _ "$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";" & @CRLF & _ "// Don't allow users to disable it" & @CRLF & _ "$wgHiddenPrefs[] = 'visualeditor-enable';" & @CRLF & _ "// OPTIONAL: Enable VisualEditor's experimental code features" & @CRLF & _ "$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1; " & @CRLF & _ "//Whether to allow users to enable the section editing. " & @CRLF & _ "$wgVisualEditorEnableVisualSectionEditing = true;" & @CRLF & _ "//Whether to enable VisualEditor for every new account. " & @CRLF & _ "$wgVisualEditorAutoAccountEnable = true;" & @CRLF & _ "//Whether to enable the wikitext source mode inside VisualEditor. " & @CRLF & _ "$wgVisualEditorEnableWikitext = true;" & @CRLF & _ "$wgDefaultUserOptions['visualeditor-newwikitext'] = 1;" & @CRLF & _ "//Whether to enable the visual diff function on the history special page. " & @CRLF & _ "$wgVisualEditorEnableDiffPage = true;" & @CRLF & _ "" & @CRLF & _ "wfLoadExtension( 'Math' ); # bundled in REL1_39" & @CRLF & _ "wfLoadExtension( 'CodeMirror' ); des" & @CRLF & _ "" & @CRLF & _ "############ Multimedia & Editors ############" & @CRLF & _ "## Other Editors" & @CRLF & _ "wfLoadExtension( 'DrawioEditor' );" & @CRLF & _ "$wgDrawioEditorBackendUrl = getenv( 'DRAWIO_SERVER' );" & @CRLF & _ "" & @CRLF & _ "######################### Page Forms ###################" & @CRLF & _ "wfLoadExtension( 'PageForms' );" & @CRLF & _ "" & @CRLF & _ "############## Uploads #####################" & @CRLF & _ "$wgEnableUploads = getenv( 'MW_ENABLE_UPLOADS' );" & @CRLF & _ "" & @CRLF & _ "####################### Bundled extensions #########################" & @CRLF & _ "#wfLoadExtension( 'AbuseFilter' );" & @CRLF & _ "wfLoadExtension( 'CategoryTree' );" & @CRLF & _ "wfLoadExtension( 'Cite' );" & @CRLF & _ "wfLoadExtension( 'CiteThisPage' );" & @CRLF & _ "wfLoadExtension( 'CodeEditor' );" & @CRLF & _ "$wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension" & @CRLF & _ "#wfLoadExtension( 'ConfirmEdit' ); //not needed for private wiki" & @CRLF & _ "wfLoadExtension( 'Gadgets' );" & @CRLF & _ "wfLoadExtension( 'ImageMap' );" & @CRLF & _ "wfLoadExtension( 'InputBox' );" & @CRLF & _ "wfLoadExtension( 'Interwiki' );" & @CRLF & _ "$wgGroupPermissions['sysop']['interwiki'] = true; // To grant sysops permissions to edit interwiki data" & @CRLF & _ "#$wgEnableScaryTranscluding = true; //To enable transclusion from other sites" & @CRLF & _ "#wfLoadExtension( 'Math' ); # bundled in REL1_39 but customized" & @CRLF & _ "wfLoadExtension( 'MultimediaViewer' );" & @CRLF & _ "$wgMediaViewerEnableByDefault = false; //to enable direct download of files" & @CRLF & _ "wfLoadExtension( 'Nuke' );" & @CRLF & _ "#wfLoadExtension( 'OATHAuth' );" & @CRLF & _ "wfLoadExtension( 'PageImages' );" & @CRLF & _ "wfLoadExtension( 'ParserFunctions' );" & @CRLF & _ "$wgPFEnableStringFunctions = true;" & @CRLF & _ "wfLoadExtension( 'PdfHandler' );" & @CRLF & _ "wfLoadExtension( 'Poem' );" & @CRLF & _ "wfLoadExtension( 'Renameuser' );" & @CRLF & _ "wfLoadExtension( 'ReplaceText' );" & @CRLF & _ "$wgGroupPermissions['bureaucrat']['replacetext'] = true;" & @CRLF & _ "#wfLoadExtension( 'Scribunto' ); # bundled in REL1_39 but customized" & @CRLF & _ "wfLoadExtension( 'SecureLinkFixer' );" & @CRLF & _ "#wfLoadExtension( 'SpamBlacklist' ); //not needed for private wiki" & @CRLF & _ "wfLoadExtension( 'SyntaxHighlight_GeSHi' );" & @CRLF & _ "#$wgPygmentizePath = '/usr/bin/pygmentize';" & @CRLF & _ "wfLoadExtension( 'TemplateData' );" & @CRLF & _ "wfLoadExtension( 'TextExtracts' );" & @CRLF & _ "wfLoadExtension( 'TitleBlacklist' );" & @CRLF & _ "#wfLoadExtension( 'VisualEditor' ); # bundled in REL1_39 but customized" & @CRLF & _ "wfLoadExtension( 'WikiEditor' );" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "##### Non-bundled Core Extensions ####" & @CRLF & _ "wfLoadExtension( 'MyVariables' ); #additional variables like USERLANGUAGECODE " & @CRLF & _ "" & @CRLF & _ "########### Semantic Mediawiki ###############" & @CRLF & _ "wfLoadExtension( 'SemanticMediaWiki' );" & @CRLF & _ "#strip protocol from MW_SITE_SERVER" & @CRLF & _ "enableSemantics( preg_replace( "#^[^:/.]*[:/]+#i", "", getenv( 'MW_SITE_SERVER' ) ) );" & @CRLF & _ "" & @CRLF & _ "#$smwgChangePropagationProtection = false; #temp fix to restore locked pages" & @CRLF & _ "$smwgQMaxSize = 50; #increase max query conditions, default 12" & @CRLF & _ "$smwgQMaxDepth = 20; #increase property chain query limit, default 4" & @CRLF & _ "$maxRecursionDepth = 5; #increase limit of nested templates in query results, default 2" & @CRLF & _ "" & @CRLF & _ "$smwgDefaultStore = 'SMWSparqlStore';" & @CRLF & _ "$smwgSparqlRepositoryConnector = 'blazegraph';" & @CRLF & _ "$smwgSparqlEndpoint["query"] = 'http://graphdb:9999/blazegraph/namespace/kb/sparql';" & @CRLF & _ "$smwgSparqlEndpoint["update"] = 'http://graphdb:9999/blazegraph/namespace/kb/sparql';" & @CRLF & _ "$smwgSparqlEndpoint["data"] = '';" & @CRLF & _ "" & @CRLF & _ "# Optional name of default graph" & @CRLF & _ "$smwgSparqlDefaultGraph = getenv( 'MW_SITE_SERVER' ) . '/id/';" & @CRLF & _ "# Namespace for export" & @CRLF & _ "$smwgNamespace = getenv( 'MW_SITE_SERVER' ) . '/id/';" & @CRLF & _ "#needs rebuild: php /var/www/html/w/extensions/SemanticMediaWiki/maintenance/rebuildData.php" & @CRLF & _ "" & @CRLF & _ "#$smwgShowFactbox = SMW_FACTBOX_NONEMPTY; #Show factboxes only if they have some content" & @CRLF & _ "#$smwgShowFactbox = SMW_FACTBOX_SHOWN; #Enable the factbox to be always shown - has no effect?" & @CRLF & _ "$smwgShowFactbox = SMW_FACTBOX_HIDDEN; #Never show it" & @CRLF & _ "" & @CRLF & _ "wfLoadExtension( 'SemanticResultFormats' );" & @CRLF & _ "wfLoadExtension( 'SemanticCompoundQueries' );" & @CRLF & _ "" & @CRLF & _ "#Enable Semantic NS" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_MAIN] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_USER] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_PROJECT] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_FILE] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_TEMPLATE] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_HELP] = true;" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[NS_CATEGORY] = true;" & @CRLF & _ "#some NS need hardcoded IDs, see https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/5281" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[102] = true; # SMW_NS_PROPERTY" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[114] = true; # SMW_NS_SCHEMA" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[108] = true; # SMW_NS_CONCEPT" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[690] = true; #Action" & @CRLF & _ "$smwgNamespacesWithSemanticLinks[692] = true; #Label" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "############# Slots ############" & @CRLF & _ "wfLoadExtension( 'WSSlots' );" & @CRLF & _ "$wgWSSlotsDefaultSlotRoleLayout = [ " & @CRLF & _ " "display" => "none"," & @CRLF & _ " "region" => "center"," & @CRLF & _ " "placement" => "append"" & @CRLF & _ "];" & @CRLF & _ "$wgWSSlotsDefinedSlots = [" & @CRLF & _ " "jsonschema" => ["content_model" => "json", "slot_role_layout" => [ "region" => "footer", "display" => "details"]]," & @CRLF & _ " "jsondata" => ["content_model" => "json", "slot_role_layout" => [ "region" => "footer", "display" => "details"]]," & @CRLF & _ " "schema_template" => ["content_model" => "text", "slot_role_layout" => [ "display" => "none"]]," & @CRLF & _ " "data_template" => ["content_model" => "wikitext", "slot_role_layout" => [ "display" => "none"]]," & @CRLF & _ " "header_template" => ["content_model" => "wikitext", "slot_role_layout" => [ "display" => "none"]]," & @CRLF & _ " "footer_template" => ["content_model" => "wikitext", "slot_role_layout" => [ "display" => "none"]]," & @CRLF & _ " "header" => [" & @CRLF & _ " "content_model" => "wikitext"," & @CRLF & _ " "slot_role_layout" => [" & @CRLF & _ " "display" => "plain"," & @CRLF & _ " "region" => "header"," & @CRLF & _ " "placement" => "prepend"" & @CRLF & _ " ]" & @CRLF & _ " ]," & @CRLF & _ " "footer" => [" & @CRLF & _ " "content_model" => "wikitext"," & @CRLF & _ " "slot_role_layout" => [" & @CRLF & _ " "display" => "plain"," & @CRLF & _ " "region" => "footer"," & @CRLF & _ " "placement" => "prepend"" & @CRLF & _ " ]" & @CRLF & _ " ]," & @CRLF & _ "];" & @CRLF & _ "$wgWSSlotsSemanticSlots = [ "data_template", "header" ];" & @CRLF & _ "$wgWSSlotsDoPurge = true;" & @CRLF & _ "$wgWSSlotsOverrideActions = false;" & @CRLF & _ "" & @CRLF & _ "############# Scribunto #############" & @CRLF & _ "wfLoadExtension( 'Scribunto' ); //bundled" & @CRLF & _ "$wgScribuntoDefaultEngine = 'luastandalone';" & @CRLF & _ "$wgScribuntoUseGeSHi = true;" & @CRLF & _ "$wgScribuntoUseCodeEditor = true;" & @CRLF & _ "wfLoadExtension( 'SemanticScribunto' );" & @CRLF & _ "" & @CRLF & _ "########### CommentStreams ###############" & @CRLF & _ "# wfLoadExtension( 'CommentStreams' ); # not enabled by default" & @CRLF & _ "# $wgCommentStreamsEnableVoting = true;" & @CRLF & _ "# $wgCommentStreamsSuppressLogsFromRCs = false;" & @CRLF & _ "# $wgCommentStreamsAllowedNamespaces = []; # not enable by default in any namespace" & @CRLF & _ "" & @CRLF & _ "######################## UI #############################" & @CRLF & _ "wfLoadExtension( 'DisplayTitle' );" & @CRLF & _ "$wgAllowDisplayTitle = true;" & @CRLF & _ "$wgRestrictDisplayTitle = false;" & @CRLF & _ "wfLoadExtension( 'SimpleBatchUpload' );" & @CRLF & _ "" & @CRLF & _ "####################### Custom Extensions ####################" & @CRLF & _ "wfLoadExtension( 'FileApi' );" & @CRLF & _ "wfLoadExtension( 'MwJson' );" & @CRLF & _ "$wgMwJsonSlotRenderResultTransformation = [" & @CRLF & _ " "enabled" => true," & @CRLF & _ "];" & @CRLF & _ "wfLoadExtension( 'OpenSemanticLab' );" & @CRLF & _ "$wgExtraSignatureNamespaces = [7100]; #allow signatures in NS LabNote" & @CRLF & _ "wfLoadExtension( 'SemanticProperties' );" & @CRLF & _ "wfLoadExtension( 'WellplateEditor' );" & @CRLF & _ "wfLoadExtension( 'SvgEditor' );" & @CRLF & _ "wfLoadExtension( 'SpreadsheetEditor' );" & @CRLF & _ "wfLoadExtension( 'ChemEditor' );" & @CRLF & _ "wfLoadExtension( 'InteractiveSemanticGraph' );" & @CRLF & _ "wfLoadExtension( 'InteractiveSemanticGraph2' );" & @CRLF & _ "wfLoadExtension( 'SciFileHandler' );" & @CRLF & _ "$wgFileExtensions = array_merge($wgFileExtensions, array(" & @CRLF & _ " 'hdf', 'h4', 'hdf4', 'he2', 'h5', 'hdf5', 'he5', # HDF File format" & @CRLF & _ " 'dx', 'jdx', 'jcm', # JCAMP-DX" & @CRLF & _ " 'mpr', 'mps', 'mpt', # Biologic" & @CRLF & _ "));" & @CRLF & _ "#wfLoadExtension( 'Chatbot' );" & @CRLF & _ "" & @CRLF & _ "####################### Custom Content #####################" & @CRLF & _ "wfLoadExtension( 'PageExchange' );" & @CRLF & _ "$wgPageExchangeFileDirectories[] = 'https://raw.githubusercontent.com/OpenSemanticLab/PagePackages/main/package_index.txt';" & @CRLF & _ "" & @CRLF & _ "$wgPageImagesNamespaces[] = 7000;" & @CRLF & _ "$wgPageImagesNamespaces[] = NS_CATEGORY;" & @CRLF & _ "$sespgEnabledPropertyList = [" & @CRLF & _ " '_PAGEIMG'," & @CRLF & _ "];" & @CRLF & _ "" & @CRLF & _ "$wgCitizenTableNowrapClasses[] = 'layout-table'; # disable wrapping of layout-table tables" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; Present the entire match result _ArrayDisplay($aArray, "Result")

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm