Re: OT URL REGEX





> 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@xxxxxxxxxxx> wrote in message
> news:d7diq2$29c$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> >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
>
> --------------------------------------------------------------------------
--
> >
> >
> >
>
>


.



Relevant Pages

  • RE: Cisco IPS 5.1
    ... Cisco IPS signature. ... URI Regex: Regular expression to search in the URI field. ... Regular expression to search in the HTTP arguments ...
    (Focus-IDS)
  • RE: Cisco IPS 5.1
    ... catches the MSN messenger client on http ports. ... reason to build a customized signature to detect http sessions with the ... I tried the header regex setting it to catch specifically this string: ... Regular expression to search in the URI field. ...
    (Focus-IDS)
  • RE: Cisco IPS 5.1
    ... you can see that Service HTTP has ... A regex looks in a certain part of the ... for looking for a specific Content-Type would be the header regex. ... Cisco IPS Signature Developer ...
    (Focus-IDS)
  • urllib http status codes
    ... Is there any way I can obtain the HTTP status codes when using the urllib module? ... As of now I can only think of doing a regex on the result of the read. ...
    (comp.lang.python)
  • Re: As I can determining if string can be turned to a numerico value?
    ... I tend to do most of my work in Perl, so regex and parsing is second nature, ... the scripts are small and the speed of execution is usually ... > Denis Dougall wrote: ... > check which is many times quicker than a regular expression. ...
    (microsoft.public.dotnet.languages.csharp)