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 expression contains 6 different sub matches to help with parsing.
1 - An extra [ 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.
6 - An extra ] to allow for escaping shortcodes with double [[]]
1 time — 0.000015 sec (very fast) | 50000 times — 0.07 sec (speed of light) | PHP 7.0.8, WP 4.6.1
No Hooks.
Return
String
. The shortcode search regular expression
Usage
get_shortcode_regex( $tagnames );
- $tagnames(array)
- List of shortcodes to find.
Default: all registered shortcodes
Notes
- Global. Array. $shortcode_tags
Changelog
Since 2.5.0 | Introduced. |
Since 4.4.0 | Added the $tagnames parameter. |