<CFSET
url="http://www.houseoffusion.com/test/test2.cfm?name=michael&date=1";>
<CFSET
sUrl=REFindNoCase('^(https?)://([-a-z0-9._]+):?([0-9]*)([-a-z0-9/\._]*)\??([
-a-z0-9/\&.?=]*)', url,1,1)>

<CFLOOP from="2" to="#ArrayLen(sUrl.pos)#" index="i">
    <cfoutput>#mid(url, sUrl.pos[i], sUrl.len[i])#</cfoutput><BR>
</CFLOOP>
<CFOUTPUT>
</CFOUTPUT>
returns a structure with the following information
1. entire string
2. protocol (http/https) - The question mark after the s makes that
character optional
3. domain name (www.houseoffusion.com) - a string of 1 or more characters
that can be a-z, 0-9, -, _, or .
4. port (80) - 0 or more numeric characters
5. path (/test/test2.cfm) - 0 or more characters that can be a-z, 0-9, -, _,
/, \, or .
6. url vars (name=michael&date=1) - 0 or more characters that come after a
question mark. they can be a-z, 0-9, -, /, \, &, ., ?, =



>
> REFind('^http://[\./-:0-9a-zA-Z]+$', URL)
>
> I want to be able to validate the url.
>
> This works
>
> REFind('^http://[\./-:0-9a-zA-Z]+$', URL)
>
> But I want to allow - _ ? & = and alphanumeric characters in the query
> string but not in the first part of the URL.
>
> What do I need to add to
>
> ^http://[\./-:0-9a-zA-Z]+$
>
> to make it work? Also, how can I make the s in https optional?
>
> Thanks,
> Sebastian
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to