This forum is for engineers working EcoStruxure Building Operation, wanting to leverage the SEAL application to improve the efficiency in the engineering process.
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send InviteCancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2025-01-2206:26 AM
Search & Replace - SEAL Script
The Concept
Search and replace is a script that allows you to search for text phrases and replace them with something else. It is a valuable tool for speeding up tedious and time-consuming renaming tasks by potentially saving you hours or even days of work, depending on the scope of the task. Furthermore, the script supports multiple text phrases, replaces content inside container objects and narrows the scope of the search with customizable options.
Additionally, you adjust the range of where to search by setting the base path on the left side. This feature is compulsory to all SEAL scripts.
Single Text Phrase
In theSearch for field, you enter what you want to find. In theReplace with field, you enter what you want to replace the matching phrase with.
By default, the script replaces all occurrences of matching strings without prompting for each instance, so make sure to specify search strings in a way that makes it only matches the parts you actually want to change. This can either be done by customizing the various options available like interlocking matching phrases with operators or by specifying object types and the properties that should be affected.
Multiple Text Phrases
What really makes this script powerful is the ability to search and replace multiple text phrases using a spreadsheet where each row represents a unique text phrase, column A contains the phrase to be searched for and column B contains the phrase to be replaced with. (Example attached)
Column A
Column B
Row 1
ReplaceThisText
WithThis
Row 2
AndThis
WithThisText
Operators
Contains
Starts With
Ends With
Regular Expressions
Case-Sensitive Match
Use Custom Regex Flags
The script executes using theContains operator by default. For anyone not familiar with the term, this simply indicates a search for any content that contains the specified text phrase, regardless of any text that resides either before or after the match in a string.
Similarly, theStarts with orEnds with operators indicates a search for any content that starts or ends with the specified text phrase, ignoring anything before or after the match. Additionally,Case-Sensitive Matching is by default active, uncheck to make sure the search returns all strings that includes the matching combination, regardless of uppercase and lowercase letters.
When selecting Regular Expression, all input will be interpreted as JS RegExp patterns. For more information regarding how to use Regular Expressions and Custom Regex Flags read this post.
Object Types
Alarms
Function Block Programs
Script Programs/Functions
Schedules
Trend Logs
Trend Charts
Values
Values (Segment)
Graphics
Folders
Folders (Segment)
Other
Narrow or widen the search by filtering what type of objects can be affected. Any object type not selected will be excluded from the search. Please note thatSegment values is unchecked by default, as any changes to theNameproperty for segment objects need to be done carefully in order not to make incidental alterations to combined segments set by rezoning as their naming needs to be intact in order to match and function properly.
Object Properties
Name
BACnet Name
Description
Note 1
Note 2
Label text
Alarm and reset message
Source name prefix
The general properties that are common amongst various types of object types can either be included or excluded from the search criteria. By default, the search includes theNameproperty andBACnet Nameproperty. This simply means that any potential match in excluded properties are ignored and will not be processed by the script.
Container Objects
Graphics
Function Block Programs
Script Programs/Functions
Container objects are bodies that contain runtime objects with a set of properties and logic. Any content stored inside these objects that matches the configured search string criteria will be replaced.
Bound values are kept intact by taking by making sure the bind path reflects any change done if an object is renamed, meaning database content can be excessively altered without resulting in deterioration.
The advantage of being able to replace content of container objects at the same time as other objects and their properties elsewhere in the database while simultaneously keeping any bindings intact so they are not lost when renaming has the potential of increasing the time-efficiency compared to doing this manually by several orders of magnitude.
The Search and Replace Script is one of our standard script available in the Standard tab when using the SEAL Script utility.
Attachments
Search and Replace Multiple Text Phrases Example.zip