I wanted to match shortcodes inside a string and found the following regex from here. It works fine. But i want to learn how it works.
Can anyone plz explain me the components of this regex and how it matches the shortcode.
preg_match_all('%(?<=[shortcode]).*?(?=[/shortcode])%s',$content, $result, PREG_PATTERN_ORDER);
There are tools to explain regular expressions.
Yours for example:
Read more about the assertions on http://www.regular-expressions.info/lookaround.html