it has to be in javascript, but if you post your php idea, I could use it too for the php part of my editor.
Printable View
it has to be in javascript, but if you post your php idea, I could use it too for the php part of my editor.
I already did, but here it is again. The only difference is that I removed the s modifier:
Could you post the complete javascript that you have so that I have something to work with?Code:<?php
$text="<img src=\"http://qwikad.com/images/logo.png\"
alt=\"something\"
title=\"something\">this
is
fine
<img src=\"http://qwikad.com/images/logo.png\"
alt=\"something\"
title=\"something\">";
$text=preg_replace('/(\r\n){1,}(?=((?!<)[\s\S])*>)/','',$text);
echo "$text";
?>
Ok, got it. Will test it over the next couple days.
What about? That's still perfectly valid HTML (and creates the same DOM as your example).Code:<
img
src
=
"http://something.com/images/something.png"
title
=
"some
thing"
alt
=
"something"
width
=
"300"
height
=
"250"
border
=
"0"
>
**********
Have you looked at the links james provided? They're good references. You can experiment with the fiddle.
So, it can have up to 16 new lines... Which is possible. I saw HTML codes formed so poorly, from all the copying and pasting, that I am not even sure WHY they work.
You mean the link to the php site? I am not sure if I can make sense of what's going on there.
He also linked to regular-expressions.info. But take a look anyway, it can be daunting to get into, but it's not "impossible."
As for newlines, the number is almost unlimited. You can have newlines almost anywhere in HTML and they don't break anything (they're considered whitespace).
You know I think I can live with what I've got. If once or twice a month someone posts something that doesn't show, it's not going to negatively impact our service as a whole. People would have to make sure that their HTML ads are formed right... if they want to see them on our site.