MediaWiki REL1_35
ResourceLoaderMwUrlModule.php
Go to the documentation of this file.
1<?php
31 public static function makeJsFromExtendedRegExp( string $content ) : string {
32 // Remove whitespace.
33 $content = preg_replace( '/\s+/', '', $content );
34 // Remove named capturing groups.
35 // This allows long regexes to be self-documenting, which we allow for
36 // developer convenience, but this syntax is invalid JavaScript ES5.
37 $content = preg_replace( '/\?<\w+?>/', '', $content );
38 // Format as a valid JavaScript import.
39 return 'module.exports = /' . strtr( $content, [ '/' => '\/' ] ) . '/;';
40 }
41}
static makeJsFromExtendedRegExp(string $content)
$content
Definition router.php:76