Jump to content

Recommended Posts

$string ="yada yada yada<pre>This is what I wants to see!</pre>";

preg_match('/<pre.*?>(.*?[<pre.*?>.*<\/pre>]*)<\/pre>/',

    $string, $matches);

echo $matches[1];

 

This outputs....This is what I wants to see!

 

If I put these pre tags in mysql or any tags....$matches come up empty. Please help. I am running php 5.3.1 and it has stream filters I cannot turn off including "stream_tags.strip". I have a remote host running php5.0.4 which does not do this. I must get on with my regex work. Thanx for any help.

Link to comment
https://forums.phpfreaks.com/topic/255398-php-is-stripping-tags-from-database/
Share on other sites

Please use the code tag on code :)

$string ="yada yada yada<pre>This is what I wants to see!</pre>";
preg_match('/<pre.*?>(.*?[<pre.*?>.*<\/pre>]*)<\/pre>/', $string, $matches);
echo $matches[1];

 

If I put these pre tags in mysql or any tags....$matches come up empty

 

If you place this into mysql you will most likely be using common basic security such as htmlentities or htmlspecialchars on the input both of which converts the < and > into their respective html codes, < and >.

 

After saying this I've come to realise I don't really know what your problem is... Could you please ask the question again in a way that we could understand? What's the regex being used for?

 

Cheers,

Joe

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.