Extract data

  • Thread starter Thread starter Tony
  • Start date Start date
T

Tony

I want to be able to see who is logging into my website so I turned on W3C
logging and then I importated it into Access. The information I need is in
one of the columns but it isn't always in the same location within that
particular column. Is there a way to have Access find the word "c_login="
and then the semicolon immeaditaly following the actual name of the user and
only display the login name? Here are 2 examples:

Example 1
What I have:
fcmcookie=homecookie;+c_login=tony;+c_login_hash=1c02bab305d5e26a6afda4bce7d
3c81d;+c_user_type=u;+c_user=tony
What I want: tony

Example 2
What I have:
c_login=day_mi;+c_login_hash=a26f8a056be8d6a6c2f9811de5da205e;+c_user_type=u
;+c_user=day_mi
What I want: day_mi

There are a few others but I didn't want to list them all. I just wanted to
give you an idea as to what I'm working with.

Any help is greatly appreciated.

Thank you in advance,
Tony
 
Mark,

The Mid function only works with numbers (ie: counts the spaces) and I'm not
familar with InStr but when I attempted to use it I couldn't get it to work.
Makes me wonder if this is what I need.

Any ideas?

Thanks,
Tony
 
The following strips off everything from the front.


MID(YourString,Instr(1,YourString,"c_login") + 7)

Say that is X, so to get everything up to the semi-colon, but one string doesn't
have a semi-colon at the end so you must add that in.

LEFT(x &";",Instr(1,x &";",";")-1)

So, substitute the above for X

LEFT(MID(YourString,Instr(1,YourString,"c_login") + 7)
&";",Instr(1,MID(YourString,Instr(1,YourString,"c_login") + 7) &";",";")-1)
 
Back
Top