Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Parse an "inputted" url string

Participant ,
Feb 13, 2009 Feb 13, 2009
I am simply trying to parse a URL for a particular value without going through len(), left(), right(), findnocase() hell. Can anyone please tell me how? I feel like I'm missing some obvious function.

Example:
I only want the value of (v).
http://www.youtube.com/watch?v=wHMZa7Qb8XI&feature=yva-title

802
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 13, 2009 Feb 13, 2009
Romeogq wrote:
I really wish there was some function that would parse the inputted url into a standard coldfusion value pair array or structure.

You can create your own, as I have done below. In fact, in cases like this, more can be less.



Translate
LEGEND ,
Feb 13, 2009 Feb 13, 2009
if v is always the first parameter in the query string, then you can use
cf list functions to get its value:

<cfset url = " http://www.youtube.com/watch?v=wHMZa7Qb8XI&feature=yva-title">
<cfset v_value = listgetat(url, 2, "=")>

if it is in varying positions in the query string, you'll need a regexp
to get its value. i am not big on regexp, so will let someone else chime
in with correct code...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 13, 2009 Feb 13, 2009
Thanks for the reply. But yeah, I'm not sure if the (v) value will ever change position... plus I wouldn't want the "&feature" that would be included in listgetat() example. I really wish there was some function that would parse the inputted url into a standard coldfusion value pair array or structure.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 13, 2009 Feb 13, 2009
Anymore help on this? Maybe somehow using cfhttp??
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2009 Feb 13, 2009
Romeogq wrote:
I really wish there was some function that would parse the inputted url into a standard coldfusion value pair array or structure.

You can create your own, as I have done below. In fact, in cases like this, more can be less.



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 13, 2009 Feb 13, 2009
LATEST
Very Niiiice, in Borat's voice. Thanks a lot!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources