Doh!

I read the part about what "." does and it didn't even register that it
won't match newlines.

Well now that part works ;)

And now one more bit. For instance to kill an onclick event I use:

 $file = preg_replace("#<(.*)onclick=\".*\"(.*)>#isU", "<\\1\\2>", $file);

Which works, kinda. Problem is, consider this:

onclick='somecode()'

It's not caught, because it only catches double quotes. How best can I say I
want code which is between single quotes, or between double quotes, without
it choking on something like: onclick='somecode("thisiswhereitwouldstop")'?

Should I just copy the regex to another line and replace single quotes with
double quotes, thus doing two searches rather than trying to do it all at
one time?


Plutarck
"Christian Reiniger" <[EMAIL PROTECTED]> wrote in message
01052120275102.00644@chrisbig">news:01052120275102.00644@chrisbig...
On Monday 21 May 2001 16:23, Plutarck wrote:

> Since there is a "/" in the code itself, I use "#" as a delimiter
> instead so I don't have to escape it, making it harder to read.
>
> So here's the code:
>
> $file = preg_replace("#<script.*>.*</script>#Ui", "<!-- RWW: Scripting
> killed -->", $file);

Stupid error (noticed this after trying for ~10 minutes...):
Add the "s" modifier. Otherwise "." doesn't match newlines.

--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

Error 032: Recursion error - see error 032

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to