| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) | ||||||||
| Account Closed Join Date: Nov 2006 Location: Uk
Posts: 601
![]() | |
| Quote: |
| Fixed a bug that disconnected some.... |
Bug Fixes
<ul class="bullet-list"><li>Fixed a bug that disconnected some....
<b class="subhead">Bug Fixes[/b]<ul class="bullet-list"><li>Fixed a bug that di
| Quote: |
| Bug Fixes[list][*]Fixed a bug that di |
<?php
function myparse($data){
$data = htmlspecialchars_decode($data);
$data = eregi_replace('<a href="(([[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]))">','[url=\\0]',$data);
$data = htmlspecialchars($data);
return $data;
}
echo myparse('<a href="http://us.rd.yahoo.com/dailynews/rss/movies/*http://news.yahoo.com/s/ap/20070527/ap_en_mo/france_cannes_awards">');
?> [url=<a href="http://us.rd.yahoo.com/dailynews/rss/movies/*http://news.yahoo.com/s/ap/20070527/ap_en_mo/france_cannes_awards">]
[url=http://us.rd.yahoo.com/dailynews/rss/movies/*http://news.yahoo.com/s/ap/20070527/ap_en_mo/france_cannes_awards]
| | #2 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | You had a mistake in that the result within the brackets was 2nd in the array so had an index of 1 (arrays are zero based). Also I notice you had the main part of the regular expression in 2 sets of brackets which made no difference to the outcome so I removed 1 set. PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| Account Closed Join Date: Nov 2006 Location: Uk
Posts: 601
![]() | Thanks Pete, I would give you rep but it doesn't like me giving you it ![]() I'm having another little problem as well now with an image function: Code: $data = eregi_replace('<img src="(([[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]))"([^\.]+)>','[img]\\1[/img]',$data); ????: NamePros.com http://www.namepros.com/showthread.php?t=332604 Any ideas? ![]() edit- also, whats the pattern for any number / type of character?
Last edited by manofgames; 05-27-2007 at 05:51 PM.
|
| |