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