Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Smile no strings attached

    mmm that will be easy one...

    that's how we checking for a specific word on a string
    Code:
    If not InStr(testMe,"codingforums") then
    now, if the user wrote a link "www.codingforums.com/page.php"
    how can i fish out the all link and to bury it in some nice dim variable?

    10Q!

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi,

    Something like this;

    Dim url

    url = Mid("www.codingforums.com/page.php", 1, inStrRev("www.codingforums.com/page.php", "/")-1)

    HTH, Tom

  • #3
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Hi Sasha and Tom --

    Tom, the problem with your code is that you are not taking into account HTTP:// and HTTPS://. You are also not providing that other folders exist in the directory structure (http://www.codingforums.com/codes/freescripts.php).

    Sasha - take a look here (taken from another post here on CF here's the original post):
    http://classicasp.aspfaq.com/general...-of-a-url.html

    What the code above does is remove the domain from a specific link. You only want the ASP page? Then you can use the code above as well just by modifying the array variant.

    Also, you can look into the Request.ServerVariables("SCRIPT_NAME") and Request.ServerVariables("SERVER_NAME") properties.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #4
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi Daemonspyre,

    My code was an example how to extract the domain from that particular string.
    No other requirements were mentioned.

    But maybe the link you posted will be helpfull for sasha85

    Tom

  • #5
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    i'm not sure yet...but...mmm

    i think tom wrote a code that pulls out a specific url...i asked about general urls...

    about the Request.ServerVariables("SCRIPT_NAME") and Request.ServerVariables("SERVER_NAME") -how they can save me?

  • #6
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Try them out and see what happens.

    Here's a quick example: no strings attached

    Request.ServerVariables("SERVER_NAME") will return "http://codingforums.com/"
    Request.ServerVariables("SCRIPT_NAME") will return "showthread.php?t=124563"

    An Additional one you may want is Request.ServerVariables("QUERY_STRING"), which will return "t=124563".

    Try the other function as well on my last post and I think you will see where this can help you.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.

  • #7
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Smile aaa nice:) good thing to know

    but that is not what i wanted
    i am tring to fish all the url's and links from the textareas...
    when the user will submit the text that it will automaticaly copy every link to some variables

  • #8
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Hi sasha,

    Use regular expressions for this task.
    Look at regexlib.com for examples.

    HTH, Tom

  • #9
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question i didn't find something usefull there...

    did you see something there?

  • #10
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Uh, yeah...

    Did YOU look?

    Tom

  • #11
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    tom

    man...there is some things connected to my fishing problem there but what i found was in php- like this http://regexadvice.com/forums/thread/35133.aspx

    do u know how to use this?
    ^(?<link>((?<prot>http:\/\/)*(?<subdomain>(www|[^\-\n]*)*)(\.)*(?<domain>[^\-\n]+)\.(?<after>[a-zA-Z]{2,3}[^>\n]*)))$

    and this one you cannot see the code
    http://regexlib.com/REDetails.aspx?regexp_id=939
    when i see php my eye gone like this
    Last edited by sasha85; 09-28-2007 at 02:39 PM.

  • #12
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Sure, it's just a pattern to match urls.
    It might look intimidating, but it's not that complicated.

    Just tell me which patterns you want to match and results you want.
    Mayby I can come up with a better pattern.

    Tom

  • #13
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Smile thank you my friend:)

    i do not need to catch specific url...but all urlsthat will be typed by users in textarea...
    every thing that starts with with http/https/ftp/www


  • #14
    Regular Coder
    Join Date
    Sep 2007
    Posts
    179
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation i think i know what i got to do but i dont know how...

    first of all to build a string with "for"
    i need to find the www/http/https/ftp with "InStr"
    to see with "len" how long the string from that char to the end (using "left" int the string value int the len function)
    than to find a space_ and to cut with mid...
    theoreticaly i guess that's how we do it but i do not have a little idea how to pull this into code
    By the time u recognize this moment, This moment will be gone.

  • #15
    Regular Coder
    Join Date
    Mar 2007
    Posts
    505
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Here's the easy way to do this:

    1) Take your textarea and split it based on vbCrLf (Visual Basic Carriage Return and Line Feed). Then use the FOR NEXT loop.

    2) Use the Classic ASP function above to adjust the URLs in your SPLIT.

    3) DONE.

    RegEx, as useful as it can be in JS and CPP (C++) is complicated. Just use what you know.

    Think about that for a little bit then come back if you can't figure it out.
    To say my fate is not tied to your fate is like saying, 'Your end of the boat is sinking.' -- Hugh Downs
    Please, if you found my post helpful, pay it forward. Go and help someone else today.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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