Advertisement
Advertisement
| 07.10.2008 at 11:51AM PDT, ID: 23554996 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: |
//Using Parentheses
$myString = "The (quick brown) fox jumped over the (lazy) dog.";
echo "<p>" . $myString . "</p>";
$newString = preg_replace("/\([^)]*\) ?/", "", $myString);
echo "<p>" . $newString . "</p>";
//OUTPUT: The fox jumped over the dog.
//This is what I tried for the angle brackets
$myString = "The <strong>quick brown</strong> fox jumped over the <span style=\"color: red;\">lazy</span> dog.";
echo "<p>" . $myString . "</p>";
$newString = preg_replace("/<[^)]*> ?/", "", $myString);
echo "<p>" . $newString . "</p>";
//OUTPUT: The dog.
//DESIRED OUTPUT: The quick brown fox jumped over the lazy dog.
|