Skip to main content
Inspiring
December 15, 2017
Answered

Get value from CGI string

  • December 15, 2017
  • 1 reply
  • 876 views

I have cgi.path_info that is always formatted like this

/data/show/80865


How do I get the ALWAYS numeric value after show/

For example, in this case, I want to get the 80865 value.

    This topic has been closed for replies.
    Correct answer WolfShade

    This can easily be done, if you treat the value as a list with / being the delimiter.

    <cfset variables.thisNumber = ListLast(cgi.path_info,'/') />

    HTH,

    ^ _ ^

    1 reply

    WolfShade
    WolfShadeCorrect answer
    Legend
    December 15, 2017

    This can easily be done, if you treat the value as a list with / being the delimiter.

    <cfset variables.thisNumber = ListLast(cgi.path_info,'/') />

    HTH,

    ^ _ ^

    weezerboyAuthor
    Inspiring
    December 15, 2017

    As always, thank you.

    WolfShade
    Legend
    December 15, 2017

    Thank you for marking my answer as correct.  I do appreciate it.

    V/r,


    ^ _ ^

    BTW.. for anyone who likes complex for the sake of complexity you can use RegEx.

    <cfset variables.thisNumber = REmatch("\d+$",cgi.path_info)[1] />