find and replace

General questions about using TextPad

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

Post Reply
afura
Posts: 3
Joined: Wed Jan 14, 2004 10:46 am

find and replace

Post by afura »

hello all,

I have to find a block of codes in order to replace it with another block of codes. The block is 200 lines.

do you have a tip?
User avatar
s_reynisson
Posts: 940
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Can you give us an example?

I do know that using TP's regular expressions on multiple lines is in most cases difficult.
The class [.*\n] for muliple lines does not work, at least not in version 4.7.2 and older.
(I may have to high hopes for version 5!)
Then I open up and see
the person fumbling here is me
a different way to be
afura
Posts: 3
Joined: Wed Jan 14, 2004 10:46 am

Post by afura »

thanks,
so here is sample of the code that I should replace

# MANDATORY MANAGEMENT ATTRIBUTES
field select ""
multiline false
edit false
name Name_ManagementInformation
label emxEngineeringCentral.Common.EPDMLabelManagementInformation
setting "Field Type" "Section Header"
setting "Registered Suite" EngineeringCentral
setting "Section Level" 1
order 1
#### ORDERING NUMBER & SUPPLIER
field select ""
multiline false
edit true
name Name_Row
label Row
setting "Field Type" "Group Holder"
setting "Group Count" 3
setting "Registered Suite" EngineeringCentral
order 2
field select $<attribute[attribute_EPDMOrderingNumber].value>
multiline false
edit true
name Name_OrderingNumber
label emxEngineeringCentral.Common.EPDMLabelOrderingNumber
setting Editable true
setting "Field Type" attribute
setting "Registered Suite" EngineeringCentral
setting Required true
order 3
field select $<to[relationship_ManufacturingResponsibility].from.name>
multiline true
edit true
name Name_Supplier
label emxEngineeringCentral.Common.EPDMLabelSupplier
range ${SUITE_DIR}/epdmEngrSearchDialogFS.jsp?form=editDataForm&field=Name_SupplierDisplay&fieldId=Name_Supplier&labelFindSearch=emxEngineeringCentral.Common.EPDMFindSupplier&baseType=type_Company&customizedSearch=search.customized.Supplier
setting "Access Expression" 'current == \"R&D Use Only\"'
setting Editable true
setting "Field Type" basic
setting "Registered Suite" EngineeringCentral
setting Rel_Linked_Type type_Company
setting Rel_Name relationship_ManufacturingResponsibility
setting Rel_Type to
setting Required true
order 4



note that for a shorter portion of code to find/replace, it works fine.
Ed
Posts: 103
Joined: Tue Mar 04, 2003 9:09 am
Location: Devon, UK

Post by Ed »

The basic technique for getting round the problem of reg expressions not coping with newlines is to convert all newlines to (say) ~. Do the substitution and then convert ~ to \n.
User avatar
s_reynisson
Posts: 940
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

So there are three steps:
1. find \n, replace with ~~~ for example
2. find # MANDATORY MANAGEMENT ATTRIBUTES.*order 4, replace with your string
3. find ~~~, replace with \n
I have used POSIX regular expression syntax, which can be selected from the
Editor page of the Preferences dialog box.
Then I open up and see
the person fumbling here is me
a different way to be
afura
Posts: 3
Joined: Wed Jan 14, 2004 10:46 am

Post by afura »

Ed , I tried your workaround without success...
Post Reply