function _shortcode_get_shortcode_regex in Shortcode 6
Same name and namespace in other branches
- 7.2 shortcode.module \_shortcode_get_shortcode_regex()
- 7 shortcode.module \_shortcode_get_shortcode_regex()
Retrieve the shortcode regular expression for searching.
The regular expression combines the shortcode tags in the regular expression in a regex class.
The regular expresion contains 6 different sub matches to help with parsing.
1/6 - An extra [ or ] to allow for escaping shortcodes with double [[]] 2 - The shortcode name 3 - The shortcode argument list 4 - The self closing / 5 - The content of a shortcode when it wraps some content.
Return value
string The shortcode search regular expression
File
- ./
shortcode.module, line 508
Code
function _shortcode_get_shortcode_regex($names) {
$tagregexp = join('|', array_map('preg_quote', $names));
// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcodes()
return '(.?)\\[(' . $tagregexp . ')\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/\\2\\])?(.?)';
}