function oembed_scheme_to_regex in oEmbed 8
Same name and namespace in other branches
- 7 oembed.oembed.inc \oembed_scheme_to_regex()
- 7.0 oembed.oembed.inc \oembed_scheme_to_regex()
Helper function that changes oEmbed schemes to regular expressions.
1 call to oembed_scheme_to_regex()
File
- ./
oembed.oembed.inc, line 74
Code
function oembed_scheme_to_regex($scheme, $capture_subpatterns = FALSE) {
$patterns = array();
$schemes = array_filter(preg_split("/(\r\n?|\n)/", $scheme));
foreach ($schemes as $scheme) {
$patterns[] = str_replace('\\*', $capture_subpatterns ? '(.*)' : '.*', preg_quote($scheme, '#'));
}
return '#' . implode('|', $patterns) . '#i';
}