Page 1 of 1

Find / Replace '&' with carriage returns

Posted: Wed Jun 14, 2006 11:35 am
by burtonfigg
Hi - I have a big block of text and would like to replace each occurrence of the ampersand with a line break, so that after the find / replace has completed, it shows each variable on a new line. I'm using TP4.7.2 on Windows 2000.

This is an example of the block of text:

cmd=_notify-validate&mc_gross=0.05&address_status=confirmed&item_number1=&payer_id=FYB2NFDU8VHU6&tax=0.00&payment_date=13%3A50%3A54+Jun+13%2C+2006+PDT&payment_status=Completed&charset=windows-1252&mc_shipping=0.00&mc_handling=0.00&mc_fee=0.05&address_country_code=GB&notify_version=2.1&custom=&payer_status=verified&address_country=United+Kingdom&num_cart_items=1&mc_handling1=0.00&mc_shipping1=0.00&txn_id=7U46232445486111K&payment_type=instantitem_name1=white+evening+dress&payment_fee=&quantity1=1&receiver_id=BCSJQDTHBXDQS&txn_type=cart&mc_gross_1=0.05&mc_currency=GBP&residence_country=GB&payment_gross=

Posted: Wed Jun 14, 2006 11:39 am
by ben_josephs
Find what: &
Replace with: \n

[X] Regular expression

Posted: Wed Jun 14, 2006 11:56 am
by burtonfigg
Thanks Ben - that worked a treat!

Now I have got to this for example:

mc_handling1=0.00
mc_shipping1=0.00
txn_id=7U46232445486111K
payment_type=instantitem_name1=white+evening+dress
payment_fee=
quantity1=1
receiver_id=BCSJQDTHBXDQS
txn_type=cart
mc_gross_1=0.05
mc_currency=GBP
residence_country=GB
payment_gross=

Do you know how I can use a RegExp to delete all to the right of the "=" sign on each line?

So I could get to this after the Find/Replace:

mc_handling1=
mc_shipping1=
txn_id=
payment_type=
payment_fee=
quantity1=
receiver_id=
txn_type=
mc_gross_1=
mc_currency=
residence_country=
payment_gross=

Thanks

Jim

Posted: Wed Jun 14, 2006 1:57 pm
by ben_josephs
Find what: =.*
Replace with: =

[X] Regular expression
Look in the help under
How to... | Find and Replace Text | Use Regular Expressions and
Reference Information | Regular Expressions and
Reference Information | Replacement Expressions.

Posted: Wed Jun 14, 2006 5:13 pm
by burtonfigg
Thanks Ben!