php - Simple Regular Expression to return text from Wordpress title - qtranslate plugin -


I am using qtranslate wordpress plugin to store blog content in multiple languages. Now I need to remove content from qtranslate tags.

Pretty $ post_title = "& lt;! - English text << - - - - & gt; & lt ;! - -: - - - Italian Text

What will happen php code & amp; Regular expression for returning text and language from this string?

Thanks a lot!

Try something like this:

  & lt ;? Php $ post_title = "& lt;! - English text <- - - - & gt; & lt ;! -: it - & gt; Italian text & lt ;! - - - & gt; ; "; $ Regexp = '/ & lt; \! -: (\ w +?) - & gt; ([^ & Lt;] +?) & Lt; \! -: - & gt; / I '; If (preg_match_all ($ regexp, $ post_title, $ matches)) {$ title = array (); $ Count = count ($ matches [0]); For ($ i = 0; $ i & lt; $ count; $ i ++) {$ titles [$ matches [1] [$ i]] = $ matches [2] [$ i]; } Print_r ($ title); } And {resonate "no matches"; }? & Gt;  

print:

  array ([en] => English text [it] => Italian text)  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -