rebuilder Posted January 17, 2011 Report Share Posted January 17, 2011 (edited) Interesē tāda lieta. Ir saturs teiksim $saturs, kas var saturēt dajebko, man vajag atlasīt vārdus, ok tas sīkums, bet tad vēl vajadzētu visus html tagus arī, bet tā, lai tos ieskaitīt kā vienu veselu, teiksim <img src="bla bla"> nesadalītu pa <img srx="bla utt. Edited January 17, 2011 by rebuilder Quote Link to comment Share on other sites More sharing options...
daGrevis Posted January 17, 2011 Report Share Posted January 17, 2011 Atlasi no <te var but kaut kas> līdz </te> vai <kaut kas />. Ar regex'iem. =] Quote Link to comment Share on other sites More sharing options...
rebuilder Posted January 17, 2011 Author Report Share Posted January 17, 2011 Būtu labi, ja varētu mazliet sīkāk. ;) P.S. kā jau minēju $saturs var saturēt pilnīgi visu tai skaitā "<" un ">" simbolus, tas to atlasīšanu nenojauks? Quote Link to comment Share on other sites More sharing options...
daGrevis Posted January 17, 2011 Report Share Posted January 17, 2011 Mēģini šādi... =) $pattern = '/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/'; $source = '<p>n<<>></p>'; if( preg_match( $pattern, $source ) ) { echo 'true'; } else { echo 'false'; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.