By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,746 Members | 1,849 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,746 IT Pros & Developers. It's quick & easy.

another regular expression q...

P: n/a
Dont ask me why, but I need a function that removes embedded ancor tags. For
instance:

<a href="xxx"> this is a <a href="xxxxx">test</a> and so <a href="xx">is</a>
this </a>

should be outputted as

<a href="xxx"> this is a test and so is this </a>

Thanks fer yer help
Jul 17 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a

"Alexander Ross" <al******@bleen.net> wrote in message
news:WFifc.142586$K91.356711@attbi_s02...
Dont ask me why, but I need a function that removes embedded ancor tags. For instance:

<a href="xxx"> this is a <a href="xxxxx">test</a> and so <a href="xx">is</a> this </a>

should be outputted as

<a href="xxx"> this is a test and so is this </a>

Thanks fer yer help


strip_tags()

Garp
Jul 17 '05 #2

P: n/a

"Alexander Ross" <al******@bleen.net> wrote in message
news:WFifc.142586$K91.356711@attbi_s02...
Dont ask me why, but I need a function that removes embedded ancor tags. For instance:

<a href="xxx"> this is a <a href="xxxxx">test</a> and so <a href="xx">is</a> this </a>

should be outputted as

<a href="xxx"> this is a test and so is this </a>

Thanks fer yer help


Oops, I didn't mean to send that one-word reply. But I deleted my real one
and it's too late to re-do it. I'll get back to you tomorrow...

Garp
Jul 17 '05 #3

P: n/a
>
Oops, I didn't mean to send that one-word reply. But I deleted my real one
and it's too late to re-do it. I'll get back to you tomorrow...

You know that you can cancel your own posts?

Regards,
Henk Burgstra
Jul 17 '05 #4

P: n/a
"Alexander Ross" <al******@bleen.net> wrote in message
news:WFifc.142586$K91.356711@attbi_s02...
Dont ask me why, but I need a function that removes embedded ancor tags. For instance:

<a href="xxx"> this is a <a href="xxxxx">test</a> and so <a href="xx">is</a> this </a>

should be outputted as

<a href="xxx"> this is a test and so is this </a>

Thanks fer yer help


No doubt about it. This calls for the power of Bobo the Clown:

function bobo($m) {
global $depth;
if($m[1]) {
$depth--;
if($depth == 0) {
return $m[0];
}
}
else {
$depth++;
if($depth == 1) {
return $m[0];
}
}
}

$depth = 0;
$r = preg_replace_callback('/<(\/?)a\b.*?>/', 'bobo', $s);
Jul 17 '05 #5

P: n/a

"Henk Burgstra" <eg****@xs4all.nl> wrote in message
news:pa****************************@xs4all.nl...

Oops, I didn't mean to send that one-word reply. But I deleted my real one and it's too late to re-do it. I'll get back to you tomorrow...

You know that you can cancel your own posts?

Regards,
Henk Burgstra


"Too late" in this case means I ran out of time, I had to go... but yes, I
know.

Garp
Jul 17 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.