SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Guest

    Re: how can I match a string in a URL?

    get the url and parse the string. there are various ways of parsing the strings.

    use string manipulation functions in the silk
    get the position in the url where GID= starts omit the previous part and work with the remaining string find position of "&" if it is present in the string and omit the portion after "&" the remaining string will be what you wanted GID=1234.



    ------------------

  2. #2
    Member
    Join Date
    Dec 2001
    Location
    Billings, MT, USA
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: how can I match a string in a URL?

    Is there any particular function that's better than another for this kind of operation?

    ------------------
    There is no try, only do. -Yoda
    Clay Givens
    Yahoo! QA Engineer

  3. #3
    Member
    Join Date
    Dec 2001
    Location
    Billings, MT, USA
    Posts
    46
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how can I match a string in a URL?

    the basics are like this:

    on my webpage, there are a bunch of records returned. each has a unique number (GID) that I'd like to pull from the URL and put in a variable.

    the url could look like this:
    http://www.hotjobs.com/cgi-bin/compa...D=145&RPPG=100

    how could I pull only the GID "145" out of the URL and store it in a variable?

    or
    http://www.hotjobs.com/cgi-bin/job-s...PENTAG=%3Cspan +class%3D%22bold-opentag%22%3E&BOLD_CLOSETAG=%3C%2Fspan%3E

    how could I pull the PINDEX "J423802CA" out of this messy URL and store it in a variable?


    ------------------
    Clay Givens
    Yahoo! QA Engineer

  4. #4
    Member
    Join Date
    Dec 2001
    Location
    chennai,TN,India
    Posts
    30
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: how can I match a string in a URL?

    AsFarAsIKnow, There's no particular fn other than String parsing....U can write a fn. like this
    STRING GetGid()
    STRING URLS= Browser.Location.GetText()
    URLS=SubStr(URLS,StrPos("GID=",URLS)+4)
    STRING Gid=SubStr(URLS,1,StrPos("&",URLS)-1)
    Return(Gid)
    Try this........


    ------------------

  5. #5
    Member
    Join Date
    Dec 1999
    Location
    Rochester, NY, USA
    Posts
    52
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: how can I match a string in a URL?

    I like to use GetField for instances like this...

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">STRING sParamDelim = &quot;&amp;&quot;
    STRING sURL = Browser.Location.GetText()
    STRING sValueGID, sValuePINDEX

    sValueGID = GetField(GetField(sURL,&quot;GID=&quot;,2),sParamD elim,1)
    sValuePINDEX = GetField(GetField(sURL,&quot;PINDEX=&quot;,2),sPar amDelim,1)</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">
    Andy Bachman

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:54 PM.

Copyright BetaSoft Inc.