>I'll start off with saying I have no idea what the first two characters
>represent here (I thought the caret was a negation operator...but I guess
>that's just in []).
The caret means that it must be looking at the beginning of the string.
>i'm a bit fuzzy on the - in front of the a-z...does that negate case
>sensitivity?)
The /i at the end of the regex means to ignore case
>I'm not sure about the asterisk...or why the second set
>of 'any combination of letters or numbers' gets grouped in parentheses.
The * means that the _expression_ in the parenthesis is optional (Zero or more times).
>not sure about the /?$/i at the end.
A slash at the end is optional (for www.amazon.com/ or www.amazon.com) and the $ means that the pattern should be at the end of the string.
Hope that helps.
Kevin.
----- Original Message -----
From: Charlie Griefer
To: CF-Talk
Sent: Wednesday, March 03, 2004 10:17 AM
Subject: Re: _javascript_ to Check link format...
would anybody mind breaking this down for those of us who are working on
picking up regex?
> From: Pascal Peters [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 03, 2004 8:27 AM
> To: CF-Talk
> Subject: RE: _javascript_ to Check link format...
>
> function checkURL(url){
> var pattern =
> /^https?:\/\/[-a-z0-9]+(\.[-a-z0-9]+)*\.([a-z]{2,3}|aero|coop|info|museu
> m|name)\/?$/i;
> return pattern.test(url);
> }
what i have and where i get stuck:
I'll start off with saying I have no idea what the first two characters
represent here (I thought the caret was a negation operator...but I guess
that's just in []). then of course, we have the http with the optional s.
two (escaped) slashes. then any combination of letters or numbers (altho
i'm a bit fuzzy on the - in front of the a-z...does that negate case
sensitivity?). a dot (escaped), once again followed by any combination of
letters or numbers. I'm not sure about the asterisk...or why the second set
of 'any combination of letters or numbers' gets grouped in parentheses.
Once again, an escaped dot, followed by any letter combo of 2-3 letters, or
any of the specified tlds. not sure about the /?$/i at the end.
any clarification on where I'm stuck (or corrections on where I'm wrong)
would be appreciated.
Charlie
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

