Advanced PHP Regex - Parse Wordpress Post Content -


i need extract text wordpress post.here code doesn't work, guess because regex, works fine on expresso, yet doesn't work on php.

$content = get_the_content(); preg_match('\<form id="form1.*?(?=<zmfj>)\', $content, $matches); $setupform = $matches[0]; echo $setupform; 

in case variable content be:

<form id="form1" method="post" action="http://google.com"><zmfj> 

so extraction result should be

<form id="form1" method="post" action="http://google.com"> 

preg_match("/<form[^>]+>/", $content, $matches); //the [^>]+ bit matches consecutive characters not ">" 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -