Font size

Searching text strings

AnyLogic allows searching for text in the workbench (the search results will be displayed in the Search view).

To search the text

  1. Open the Search dialog box by clicking the Search toolbar button.

    The Search dialog box

  2. Type the expression for which you wish to do the text search in the Containing Text box. From the drop-down menu, you can choose to repeat or modify a recent search. When entering text, you can use wildcards for search expressions displayed in the search dialog:
    • "*" matches any set of characters, including the empty string
    • "?" matches for any character
    • "" is the escape for a literal; if you want to search for an asterisk, question mark, or backslash character, type a backslash before it to indicate that you are not using these characters as wildcards (e.g., "*", "?", or "")
  3. Turn the Case Sensitive option on if you want the text search to be case sensitive.
  4. Turn the Regular Expression option on if you want to specify a pattern facet. A pattern facet can be used to constrain the value of a lexical space (the set of string literals that represent the values), which indirectly constrains the value space. The value of the pattern is called a regular expression. For more information on pattern syntax, please refer to java.util.regex.Pattern class documentation.
  5. Choose the scope of your search using the Scope radio buttons. You can either search through the whole workspace (Workspace option), or previously selected model element only (Selection option). In case you search through the selection, the search is done through all branches of the workspace subtree starting from the selection point.
  6. Click Search to finish. The search results will be displayed in the Search view.
  7. If you want to replace the search results with something else, click the Replace button and in the Replace window you'll be offered to enter the value which will replace the search results.

Search View

This view displays the results of a text search.

Here is what the Search view looks like:

The Search view

To show/hide the Search view

  1. Choose View > Search from the main menu.

Search results are displayed as branches of your workspace tree leading down to the model elements containing string matching search expression. For example, your search can output that the looked for text is found in some property of a model element. You can simply proceed to this particular property by double-clicking it in the search tree. The element with the text string matching the search expression will be selected in the workspace tree, and the string will be highlighted in the Properties view opened for this element.

Icon Command Description
Show Next Match This command highlights the next match in the workspace.
Show Previous Match This command highlights the previous match in the workspace.
Expand All Expand all matches in the hierarchical view.
Collapse All Collapse all matches in the hierarchical view.
Run the Current Search Again Run the search with the current settings again.
Show Previous Searches This command allows you to browse previously conducted searches and repeat a previous search. You can select a previous search from the drop-down menu or clear the search history.
How can we improve this article?