|
Posted by MS on 10/10/55 11:17
> How flexible does the regular expression have to be?
I want to regex http static urls and dynamic urls.
I think basically i want to make sure there is...
at the beginning,...
http://www
or minimum of
http://
and maybe that there is no illegal characters within the url
>
> The regular expression you have in your example will match http or httpsor
> ftp protocol servers that have IP addresses or names with extensions of 2
or
> more characters.
Not so bothered about the https or ftp or ip
Thnx
Alex
>
> There are a lot of references out there that can help yor correctly
validate
> urls.
>
> For your url in question:
>
> http://www.awin1.com/awclick.php?mid=xxx&id=xxxx
>
> this is saying that you want the above url where there is a couple of
> numbers of 1-4 digits that can change.
>
> "^http\:\/\/www\.awin1\.com\/awclick\.php\?mid=[0-9]{1,4}&id=[0-9]{1,4}"
>
> as in
>
> <?php
> $regex =
> "^http\:\/\/www\.awin1\.com\/awclick\.php\?mid=[0-9]{1,}&id=[0-9]{1,}";
> $url="http://www.awin1.com/awclick.php?mid=1&id=123";
> if(eregi($regex,$url)){
> echo "yes";
> } else {
> echo "no";
> }
> ?>
>
>
>
> "MS" <nospamplaesegr8t_ukuk@yahoo.co.uk> wrote in message
> news:d7diq2$29c$1@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
> >I know this is not really the place for this question but as I can not
find
> > a REGEX newsgroup I thought somebody here will have already solved this
> > problem.
> >
> > I need a regex for validating urls.
> >
> > I got one off a website which is as follows...
> >
> >
if(eregi("^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)
> > ([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$", $url)){
> >
> > but this does not allow dynamic urls the type you would get with
affiliate
> > programs...
> >
> > eg. http://www.awin1.com/awclick.php?mid=xxx&id=xxxx
> >
> > has anyone got a regex for URLs that would help me?
> >
> > Thanx in advance.
> > Alex
> >
> > --
>
> --------------------------------------------------------------------------
--
> > http://www.clickonlingerie.com?SIG - Exotic Erotic Lingerie
>
> --------------------------------------------------------------------------
--
> >
> >
> >
>
>
[Back to original message]
|