Skip to content

Instantly share code, notes, and snippets.

@jorwan
Last active August 29, 2015 13:57
Show Gist options
  • Save jorwan/9749434 to your computer and use it in GitHub Desktop.
Save jorwan/9749434 to your computer and use it in GitHub Desktop.
<?php
$formMatch = array();
$code = '<form name="otro_texto_que_sacare">texto_que_sacare</form>';
preg_match_all("/<form (.*?)>(.*?)<\/form>/i", $code, $matches, PREG_SET_ORDER);
foreach ($matches as $data)
{
print_r($data);
}
Me gusto mas este flag : PREG_PATTERN_ORDER
$formMatch = array();
$code = "<div id='spot_title'>Blue</div><div id='main_description'>Sint sit rerum ea vel eos consequatur. Aut cumque maxime est provident.</div><div id='price'>US$195</div>";
preg_match_all("/main_description'>(.*?)<\/div>/i", $code, $matches, PREG_PATTERN_ORDER );
print_r($matches[1][0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment