You are here: Re: [PHP] Re: Filtering URLs problem.. « PHP « IT news, forums, messages
Re: [PHP] Re: Filtering URLs problem..

Posted by Al on 10/02/75 11:35

Jochem Maas wrote:
>
> ...
>
>>>>
>> Jochem's correct. I was in too big a hurry trying to help. It was
>
>
> you don't mind if I forward that to my girlfriend? ;-) (the bit about me
> being correct)
>
>> obvious that Anders was not getting much useful help. His points 3 and 4
>
>
> the lack of help is due to the fact that the problem is much easier to
> explain/understand than to solve properly, and starting out with regular
> expressions is a steep learning curve. that said I think the OP has plenty
> of stuff to put his teeth into.
>
>> are valid and I was not addressing them because they require more work
>> than I have time to devote.
>
>
> fair enough :-)
>
>>
>> Here is corrected code. It works with the "Regex Coach". I did not try
>> it with a php script.
>>
>> $types= (http|ftp|https|mms|irc);
>
>
> I think there are a couple of single quotes missing in tyhe line above,
> and the parentheses are probably meant to be square brackets:
>
> $types= '[http|ftp|https|mms|irc]';
>
>>
>> $pattern=
>> "%<a\040href\040*=['\"]$types://((www.)*[\w/\.]+)['\"]>.+</a>%i"; //
>> the "i" makes it non case sensitive
>>
>> if(preg_match($pattern, $URL_str, $match)){
>>
>> $URL= match[2];
>> }
>>
>> else{
>>
>> User did not enter a complete link; do the simple thing
>> }
>>
...
think there are a couple of single quotes missing in tyhe line above,

['\"] says either single or double quote.

and the parentheses are probably meant to be square brackets:

$types= '[http|ftp|https|mms|irc]'; Says: every "h" every "t" every "p" every "|"..... etc.

He needs (http|ftp|https|mms|irc); Which says "http" or "ftp" or https .... etc.

Note, I'm using $match[2], not $match[1].

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация