Jump to content
php.lv forumi

preg_mach vai ko izmantot?


rebuilder

Recommended Posts

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 by rebuilder
Link to comment
Share on other sites

Mēģini šādi... =)

 

$pattern = '/^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$/';
$source = '<p>n<<>></p>';


if( preg_match( $pattern, $source ) ) {

echo 'true';

} else {

echo 'false';

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...