filter data

T

Tony

I need to filter through lines of text and extract certain pieces. The
location of the text I need is in different areas. Can anyone tell me how
to do this? Here are some examples to better explain what I'm after.


c_login_hash=4698318f7583fb3647679a0ef6f4968a;+c_login=wealth;+c_user=wealth
;+c_user_type=u


c_login=abwang;+c_login_hash=a772b8f32fed82a4b6376b3387636370;+c_user_type=u
;+c_user=abwang


c_login=bp;+c_login_hash=72d08ec2e9e4c33e33404d0d42ce29dd;+c_user_type=p;+c_
user=ravinvi


c_login=clawrence;+c_login_hash=1163359b3c3ed86e774ba4bb85864b9c;+c_user_typ
e=p;+c_user=lawbros


What I need to extract is the name after "c_login=" and the name after
"c_user=" so I can use this data.

Please help!

Thank you in advance,
Tony
 
A

Allen Browne

Use Split() to parse the input line into an array of values.
Loop though the array from lbound to ubound.
Use Instr() to locate the position of "=", and Left() and Mid() to parse out
the values.
 
T

Tony

Anyway I could talk you into typing that for me because I really don't know
what you're talking about.

Sorry for being an idiot.

Thanks,
Tony
 
A

Allen Browne

Tony, I don't think it will really help if I did take the time to code for
you, as you aren't learning.
 
T

Tony

Do I do this is a query or a module. I tried it in a query and look in the
help file on "split" and nothing came up. I don't know the first thing
about writing a module if this is what I need to do.

Thanks,
Tony
 
A

Allen Browne

Press Ctrl+G to open the Immediate Window.

You can practice there, e.g. you can find where to start reading in the
string with:
? Instr("...+c_user=wealth;+c_user_type=...", "+c_user=")+7

Then use Mid() to parse the string.

Once you get this returning the right stuff in the Immediate Window, you
will end up with an expression (a long one) that you can enter as a
calculated field in your query.

Ignore Split() if you are not familiar with code. Instr() and Mid() should
do the job.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top