note 81213 deleted from function.preg-replace by nlopess
| From: | nlopess@php.net | Date: | Mon, 18 Feb 2008 23:25:18 +0000 |
| Subject: | note 81213 deleted from function.preg-replace by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-136257@lists.php.net to get a copy of this message | ||
Note Submitter: info at ipsistemos dot org
----
I've written simple script which removes links from text.
<?php
/*REMOVES LINKS FROM YOURS TEXT*/
$stringToEdit="<a href=\"http://www.vilnius.lt/newvilniusweb/index.php/6/?env=2\"
title=\"Naujienos\">Naujienos</a>";
$pattern = '/[< 0-9a-z]+[href=]["0-9A-Za-z:.\/&#;%? \-=]+[>]/';
$pattern1 = '/[<]+[\/]+[0-9a-z]+[>]/';
$replacement ='';
$stringToEdit=preg_replace($pattern, $replacement, $stringToEdit);
$editedString=preg_replace($pattern1, $replacement, $stringToEdit);
echo $editedString;
?>