This JavaScript value extractor would be pretty easy to translate to CF too:

http://www.quirksmode.org/js/detect.html

On 6/10/12 10:39 AM, RICHARD SIMPSON II wrote:
> HTTP_USER_AGENT : String ReReplace (UNFINISHED)
>
> <------------------------------------>
> My idea is to extract each instance before ";" so we can auto detect 
> operating systems, browser versions, and future devices. This data can be 
> placed in a table, xml file, etc. Thus, it can be logged, massaged for 
> css/html5, j-Queried, etc.
>
> I'm not sure if this is the best way to do this.
> But it is worth a spin on some ideas. Thanks and CF STILL ROCKS.
> <------------------------------------>
>
> <!--- REPLACE THE FIRST '(' WITH NOTHING '', CREATING A SPACE --->
> <cfset TheString = REReplace(HTTP_USER_AGENT, '\(', '', 'ALL') />
> <!-- TheString: #TheString#<br /><br /> -->
>
> <!--- REPLACE THE FIRST ')' WITH NOTHING '', CREATING A SPACE --->
> <cfset TheString2 = REReplace(TheString, '\)', '', 'ALL') />
> <!-- TheString2: #TheString2#<br /><br /> -->
>
> <!--- REPLACE THE SPACES ' ' WITH ';', CREATING A ";" SPACER --->
> <cfset TheString3 = replace(TheString2, ' ',';', 'ALL') />
> <!-- TheString3: #TheString3#<br /><br /> -->
>
> <!--- FOUND PROBLEM WITH "Windows;NT;5.1;;" (REPLACE THE ";;" NO PUN 
> INTENDED!) --->
> <cfset TheString4 = REReplace(TheString3, '\;;', ';', 'ALL') />
> <!-- TheString4: #TheString4#<br /><br /> -->
>
> WORKING OUTPUT: 
> Mozilla/5.0;Windows;NT;5.1;rv:2.0.1;Gecko/20100101;Firefox/4.0.1
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351526
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to