Page 1 of 1

<a href="this is a format problem">"'&q

Posted: Thu May 22, 2003 3:52 am
by theclay7
'http://www.cnn.com

if I insert <a href='http://www.cnn.com> Without closing quote </a>

my code will die and as you may see from the above code, what I want to do is

1) if I have a ' before http:// , it will turn into htmlspecialchars

2) how do i count/extract everything within [URL.....[/URL] ?


another question....

I have a hidden code that will embedded with with user's message, say if the user type "hello", it acutally is

"<!--DO NOT REMOVE THIS## <B> date()--> hello <!--DO NOT REMOVE THIS ## </B>-->"

and the whole thing will be inserted into the database

i want to remove everything EXCEPT "hello"
when the USER want to "EDIT" the message....

how can I do that?
http://www.cnn.com

Posted: Thu May 22, 2003 4:45 am
by patrikG
One way would be to use explode or any combination of the string-functions.

To my mind a cleaner (but more complicated, yet more powerful) solution would be using regular expressions, i.e. preg_match or preg_match_all.

I don't have a regEx for URLs handy - there are plenty of regEx-collections available online, though - and they always need to be indiviually adapted to the task at hand.