capsx Posted July 28, 2003 Report Share Posted July 28, 2003 preg_match('/<td>(.*)</td>/i',$filevar,$blocks); ja ir vairaaki <td>1</td><td>2</td><td>3</td> utt kaa lai atgriezh tikai pirmo <td>1</td> nevis <td>1</td><td>2</td><td>3</td> ? Link to comment Share on other sites More sharing options...
Venom Posted July 28, 2003 Report Share Posted July 28, 2003 preg_match('/matchs/iU'); tas "U" nosaka "Ungreedy", t.i. meklēs nevis lielāko sakrītošo stringu, bet gan mazāko (jebšu līdz pirmajam <td>) Link to comment Share on other sites More sharing options...
laacz Posted July 29, 2003 Report Share Posted July 29, 2003 <code><font color="#000000"> preg_match_all('/<td>(.*)</td>/iU', $string, $matches);</font> </code> Link to comment Share on other sites More sharing options...
loderis Posted February 25, 2005 Report Share Posted February 25, 2005 teksts satur: <p><table class="main" border="0" cellspacing="0" cellpadding="0"><tr><td class="embedded"><h1 style="margin:0px">username<img src="bilde.gif" alt="nosaukums" style="border:0; margin-left:4pt" /></h1></td></tr></table></p> vajag izlobīt "username", rakstu šādi, bet nekas nesanāk. preg_match("/<h1 style=\"margin:0px\">([^<]*)<",$text,$matches); Link to comment Share on other sites More sharing options...
bubu Posted February 25, 2005 Report Share Posted February 25, 2005 (edited) preg_match('@\<h1[^>]*\>([^<]+)\<img@', $text, $match); Edited February 25, 2005 by bubu Link to comment Share on other sites More sharing options...
loderis Posted February 25, 2005 Report Share Posted February 25, 2005 liels paldies. Link to comment Share on other sites More sharing options...
loderis Posted February 27, 2005 Report Share Posted February 27, 2005 (edited) radās vēlviena aizķeršanās. lapa satur: [avatar=adrese.png]affa<br />aaaa<br /> bbb<br /> [/avatar] vajag piepildīt array ar vērtībām: array[0]='affa' array[1]='aaaa' utt Edit: ir doma ar šo /\[avatar.*](.*<br \/>\r\n)*\[\/avatar]/ izlobīt visu "[avatar=...]un ar visu kas ieksā[/avatar]", tad to stringu apstrādāt, varbūt ir cita iespēja? Edited February 27, 2005 by loderis Link to comment Share on other sites More sharing options...
bubu Posted February 27, 2005 Report Share Posted February 27, 2005 <?php $txt = "[avatar=adrese.png]affa<br />\naaaa<br />\nbbb<br />\n[/avatar]"; $array = array(); $t = "[avatar=adrese.png]"; $p1 = strpos($txt, $t); $p2 = strpos($txt, "[/avatar]"); $txt = substr($txt, $p1+strlen($t), $p2-$p1-strlen($t)); if (preg_match_all('@([^<]+)\<br /\>'."\n".'?@m', $txt, $matches)) { for ($i=0; $i<count($matches[1]); $i++) { $array[] = $matches[1][$i]; } } print_r($array); ?> Link to comment Share on other sites More sharing options...
Recommended Posts