Find / Replace '&' with carriage returns

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
burtonfigg
Posts: 11
Joined: Wed Jun 01, 2005 6:37 pm

Find / Replace '&' with carriage returns

Post 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=
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: &
Replace with: \n

[X] Regular expression
burtonfigg
Posts: 11
Joined: Wed Jun 01, 2005 6:37 pm

Post 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
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post 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.
burtonfigg
Posts: 11
Joined: Wed Jun 01, 2005 6:37 pm

Post by burtonfigg »

Thanks Ben!
Post Reply