You already know you are in the process of including a form, so the rest of the tag is pretty useless within the plugin. preg_replace is used to extract the parameter parts of the plugin tag that was matched by the first pattern ??? all the ???[^~]*??? text, if any.