View Full Version : no strings attached
09-27-2007, 04:22 AM
mmm that will be easy one...
that's how we checking for a specific word on a string
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?
09-27-2007, 08:46 AM
Something like this;
url = Mid("www.codingforums.com/page.php", 1, inStrRev("www.codingforums.com/page.php", "/")-1)
09-27-2007, 01:25 PM
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://www.codingforums.com/showthread.php?t=121210)):
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.
09-27-2007, 05:50 PM
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
09-27-2007, 06:20 PM
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?:rolleyes:
09-27-2007, 10:33 PM
Try them out and see what happens. :)
Here's a quick example: http://codingforums.com/showthread.php?t=124563
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.
09-28-2007, 12:57 AM
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:D
09-28-2007, 07:34 AM
Use regular expressions for this task.
Look at regexlib.com for examples.
09-28-2007, 01:13 PM
did you see something there?
09-28-2007, 02:06 PM
Did YOU look?
09-28-2007, 02:30 PM
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?
and this one you cannot see the code
when i see php my eye gone like this:eek:
09-28-2007, 03:29 PM
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.
09-28-2007, 04:09 PM
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
10-01-2007, 04:49 AM
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:(
10-02-2007, 01:26 PM
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.
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.
10-02-2007, 02:01 PM
i split it to words-than look if it is valid url and if it is i saved it...realy simple:)