i have 1 problem. on website, have <div id="alpha_bravo">
, links inside. looks this:
<div id="alpha_bravo"> <p>text text text <a href="...">link</a></p> </div>
i want change every <a href...>
funny text suprise
, example.
how can it?
since tagged question php , comments below question seems may want use server-side functionality, i'm going give example using php.
one way replace links. looking preg_replace() function replace substrings in string based on regex pattern.
$input = "<div id='alpha_bravo'><p>text text text <a href='...'>link</a> , <a href='...'>another link</a></p></div>"; $output = preg_replace("/<a (.*?)>(.*?)<\/a>/i", "surprise", $input);
you can remove html tags in string using strip_tags() function.
$input = "<div id='alpha_bravo'><p>text text text <a href='...'>link</a> , <a href='...'>another link</a></p></div>"; $output = strip_tags($input);
Comments
Post a Comment