Page 1 of 1

find and replace

Posted: Wed Jan 14, 2004 10:51 am
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?

Posted: Wed Jan 14, 2004 11:31 am
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!)

Posted: Wed Jan 14, 2004 1:15 pm
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.

Posted: Wed Jan 14, 2004 1:24 pm
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.

Posted: Wed Jan 14, 2004 1:47 pm
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.

Posted: Wed Jan 14, 2004 1:51 pm
by afura
Ed , I tried your workaround without success...