View Full Version : parse string question

07-21-2004, 06:06 PM
I'm trying to parse my log file and extract data from it,
but i'm stuck on one part,,

i'm trying to get just the domain this line:

www.domain.com:05/28/2004 14:02:18 - Add.Info: Nas= (ID:) Port=32

i am able to remove everything in front of the www. because it appears the same number of characters in for every line, but the lenth of the name changes.

if i use:
strUrl = Mid(test,InStrRev(test , ":") + 1)
then i'm only left with everything after the :,

so how can i get just the domain, everything before : ?

thanks for ur time!

07-21-2004, 06:23 PM
You can use a regular expression to isolate the domain name.

This pattern should work:


Assuming that there will always be a host header name (e.g. www) on the domain name. If that is not the case, ommit the red part of the pattern.

If you are unfamiliar with regular expressions check these links out: