-

GLOBAL FIND AND REPLACE Window

The GLOBAL FIND AND REPLACE window, located in the Cross Function Area at the lower screen border, can be used to find and replace text strings within the entire engineering project. Also observe the local text search/replace function ‣ Local Text Search/Replace in the Text Editor
×‣ Local Text Search/Replace in FBD/LD, NOLD, SNOLD and SFC
×‣ Local Text Search/Replace in the HMI Editor
×
available in the graphic and textual code editor.

Local text search/replace is also possible in the HMI editor.

Note
Only editable strings can be replaced.

Note
'Replace All' is not available in safety-related POUs.

You can hide/show the window by clicking the button shown left on the Cross Function Area toolbar. Pressing <Shift> + <Ctrl> + <F> opens the window with the 'Find what' field focused and <Shift> + <Ctrl> + <H> opens the window with the 'Replace' field focused.
For closing the window, you can also click the cross icon on the right of the window title bar:

How to pin/unpin the window in the Cross Function Area  

How to undock/dock the window  /

Using the GLOBAL FIND AND REPLACE window, each occurrence of a string can be found in the entire project. Furthermore, editable strings can be replaced throughout the project.

Find and replace text as follows.
  1. Enter the text to be found into the 'Find what' field.
  2. If desired, you can set some find options by clicking the following toolbar icon:

    (See section below for a description.)
    Here, you can use wildcards or regular expressions.

    Note
    Incorrect 'Find options' may lead to an invalid search result. Make sure that the checked options are suitable for the entered search string.

  3. Press <Enter> or click the 'Find All' button:

    All found occurrences are now listed as expandable result list in the window. (For each search operation, a new result list is added on top introduced by the icon.)

    • Click the toggle icons / at the beginning of each result list to expand/collapse the list.
    • You can directly access the location (editor or table) where the string was found by simply double-clicking an entry in a result list.
  4. To replace text, enter the desired string into the 'Replace with' field.
    • Click 'Replace' to replace only the occurrence selected in the result list. This command is only active after selecting a found occurrence in an expanded result list.
    • Click 'Replace All' to replace all occurrences of the found string, independently of any selection in the result list.

      'Replace All' is not available in safety-related POUs. Replace occurrences manually. Refer to the section "Toolbar" below for details.

    After executing 'Replace All', an new expandable result list is added, listing the done replace operations. The new result list is added on top, introduced by the icon.
    Click the toggle icons / at the beginning of each result list to expand/collapse the list.

Toolbar

ButtonDescription
Finds all occurrences of the search string.
Shows the find options which allow you to customize the search.
Replaces the current occurrence of the search string by the replace string.
Replaces all occurrences of the search string by the replace string.

'Replace All' is not available in safety-related POUs. Replace manually instead...
Cancels the ongoing search (button is only active while a search is being performed).

Commands in result lists

For each operation in the GLOBAL FIND AND REPLACE window, a new result list is added on top of already existing lists.

Each result is introduced by an icon which indicates the performed action ( or icon) and each list can be expanded/collapsed by clicking the toggle icons /.

The following commands are available in the context menu of the result list entries:

Find options

The find options are displayed by clicking the button on the search bar.
The following options act as filters if checked. The button is highlighted with a yellow border if a find option is activated.

Find optionDescription
Find backwardIf activated, the search string is searched (and replaced) backward inside the editor from the current cursor position/selected object in the editor to the top of the editor. In case the top of the editor is reached, the search will automatically restart from the end of the editor.
Match CaseIf activated, the search is done case-sensitive: only text matching upper and lower cases of the entered search string is found.
Match whole wordThe found text has to match with the whole search text. Like 'Match Case', this option is also useful to limit the number of found text occurrences.
Use wildcardsThe use of the wildcards '*' and '?' is allowed in the search text:

? represents a single character in the search string,
* represents one or more characters in the search string.

The wildcards can be combined in the search string.
Use regular expressionsRegular expressions allow more complex text searches by entering particular search patterns, i.e., search strings that follow a defined syntax. The most relevant expressions are listed below.

Regular expressions

As PLCnext Engineer is based on .NET, thus using the Regular Expression Language, more regular expressions are available than these listed here. The table, however, only lists expressions useful in practice of PLCnext Engineer.

Note
The expressions shown below can be combined.

ExpressionDescriptionExamples
*Quantifier: matches the previous element zero, one or more times.'Find what': \d*.5

Found: 1.5, 999.5, .5
+Quantifier: matches the previous element one or more times.'Find what': o+ ('Match Case' unchecked)

Found: OO in BOOL and o in PLCMODE_ON (variable name)
|Alternation, i.e., logical OR combination of search terms: matches any one term separated by the | character.'Find what': In(Var|Signal)

Found: InVar and InSignal
[first-last]Character range: matches any single character in the range from first to last.'Find what': [A-C]

Found: A and C in ACDC1974

'Find what': [1-5]

Found: 1 and 4 in ACDC1974
[c1..c2..c3]Character selection: matches each single character specified within brackets, separated by "..". 'Find what': [1..4..7]

Found: 1 and 4 and 7 in ACDC1974
\dCharacter selection: matches any decimal digit.'Find what': \d

Found:

Text worksheet: 0 and 1 in C001

Graphical worksheet: literal containing a decimal number as well as CTD_1 instance name.
\sCharacter selection: matches any white space.'Find what': \s

Found:

Graphical worksheet: spaces in comments
^Position anchor: the match must start at the beginning of the string or line.'Find what': ^CTD

Found:

Text worksheet: CTD_1 in CTD_1 : CTD;

Graphical worksheet: instance name and FB name, standing alone
Variables table: type in instance declaration

$Position anchor: the match must start at the end of the string or line.'Find what': TON$

Found:

Graphical worksheet: instance name, standing alone, and TON at the end of the comment string.