php - Extract strings inside shortcodes -


i have string may contain shortcodes such this string [e]with[/e] multiple [e]shortcodes[/e]. want extract strings: "with" , "shortcodes" array.

$string_with_shortcodes = "this string [e]with[/e] multiple [e]shortcodes[/e]"; 

how can this?

$count = preg_match_all("\01\[e\](.*?)\[/e\]\01", $string_with_shortcodes, $matches); $shortcodes_array = $matches[1]; 

based on example gave,

  • $matches[0] contain: array("[e]with[/e]","[e]shortcodes[/e]")
  • $matches[1] contain: array("with","shortcodes")

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -