The searchReplace Component lets you search and (optionally) replace text in operators. The replace operation is undoable.
It will search and optionally replace all text in DATs, operator names, parameter values/expressions/bind expressions, custom parameter names, custom parameter menu items, custom parameter page names, and fieldCOMP text.
To search a single operator, or a component recursively, set the
Searchinop parameter. The first input allows you to provide a table of operators (
path column) to search non-recursively. The second input allows you to provide a table of multiple search/replace string options in
Version - Component version number.
Help - Open this help page.
Search In OP
Searchinop - Operator to search inside. All children of components will be searched recursively.
Searchstring - The string to search for.
Replacestring - The string to replace searched string with.
Go - Perform the chosen operation.
Operation - Choose
Search Only or
Search and Replace.
Casesensitive - Case sensitive search.
Wholewords - Look for search string only when it is not part of a larger word. Any non alpha-numeric characters are considered word boundaries.
- Example: Searching for 'par' with Whole Words on will find
me.par.limitbut will not find
Regularexpressions - When on, search string will be processed as a regular expression.
Operator Type Filter
Operatortypefilter - Only operators of the given Python class will be displayed. For example,
DAT will show all DAT types and
panelexecDAT will show only Panel Exec DATs. Accepts a space-separated list.
Filterscript - A Python expression to filter results, where
operator is the operator being tested. For example,
operator.par.parentshortcut != "" will only show operators with a parent shortcut.
Limit Max Depth
Limitmaxdepth - If True, limit the network depth of the search to "Maximum Depth"
Maximumdepth - Maximum depth of search. 0 is only the search operator itself. 1 is the selected operator and its children, 2 is the selected operator, its children and its grand-children etc.
Include Non-Editable DATs
Includenoneditabledats - If True, search DATs that can't be edited (and thus can't have text replaced in them)
Include Builtin Pars/Pages
Includebuiltinparspages - If True, search built-in par and page names that can't be changed (and thus can't have text replaced in them). Their editable values/expressions/etc. will always be included.
Include Hidden OPs
Includehiddenops - If True, include operators whose
expose members are False. (e.g. /sys)
Search DAT Text
Searchdattext - Search text in DATs.
Search Par Data
Searchpardata - Search parameter values and expressions.
Search Field Text
Searchfieldtext - Search the panel.field member of fieldCOMPs.
Search tags - Search tag text.
Search OP Names
Searchopnames - Search operator names.
Search Par Page Names
Searchparpagenames - Search parameter page names.
Search Par Labels
Searchparlabels - Seach parameter labels.
Search Par Names
Searchparnames - Seach parameter names.
Search Par Menu Items
Searchparmenuitems - Search parameter menu items (names and labels).
Open Result Table
Openresulttable - Open a view of the search result table, which is also available through the Component's DAT output.
Clear Result Table
Clearresulttable - Clear all search results from the result table.
Clear Results Before Search
Clearresultsbeforesearch - When on, clear the result table automatically before searching.
Search Again After Replace
Searchagainafterreplace - Automatically search again after replace operations.
Results Show Par Labels
Resultsshowparlabels - When True, use parameter labels instead of names in results.
First N Matches
Firstnmatches - Stop matching after finding the string in a given number of Operators.
N - The number of matches to stop after.
Search OP 'path' table: A table of OP paths to be searched. Must have a column with header: "path". Note that these OPs' children will not be searched. To search an OP's children use the Search OP parameter.
'search' 'replace' table: A table of search and replace strings. Must have a column with header: "search" and a column with header: "replace".
Results: a list of results from the last operation.
The searchReplace component does not use wildcards. Use this feature for all non-specific searches. Regular expressions are a powerful system used for string search and replace. An internet search will return many regular expression resources, but below are a few good places to start.
Regular Expression Examples
These are very simple examples of things you can do with regular expressions. See full documentation for more.
par.→ par followed by any character: pars, par1, parm
par...→ par followed by any three characters: parent, par123
par\.→ par followed by the '.' character: par. ONLY
par.*→ par followed by any number (including 0) of any character: parent, parsimonious, par1, parm, par
par\b→ par followed by any word boundary, which amounts to anything that ends with "par": par, ropar, 12par,
par1*→ par followed by any number (including 0) of the character "1": par, par1, par1111
par1+→ par followed by any number (excluding 0) of the character "1": par1, par1111
par[a-e]→ par followed by a letter "a" through "e": para, pard, pare
par[^a-e]→ par followed by any character that is not the letters "a" through "e": parh, par1, par]
par[a-e]*→ par followed by any number of instances of the letters "a" through "e": paraaaa, par, pardae
par[a-eX]*→ par followed by any number of instances of the letters "a" through "e" or 'X': paraeXa, parX, par
par\d*→ par followed by any number of digits: par, par58123, par0
par\d\d*→ par followed by at least one digits: par58123, par0
par\w→ par followed by any word character: par1, para
Regular Expression Escape Sequences
There are a number of useful regular expression escape sequences (starting with backslash character). See full documentation for more.
\d: a digit (0-9)
\s: a whitespace character
\S: a non-whitespace character
\w: a "word" character (a-z, A-Z, 0-9, and _)
\W: a non-"word" character (not a-z, A-Z, 0-9, or _)
Replacements in Regular Expressions
Replacements are also extremely powerful in Regular Expressions, using a simple grouping system. Use parenthesis to separate any number of regular expressions, then in the replacement string, reference those groups using
\g<#> with # being the group number. See full documentation for more info.
god\g<1>→ dog3 becomes god3, dog0 becomes god0 etc.
\g<2>\g<1>→ dog3 becomes 3dog, god0 becomes 0god etc. Note: the
|character is an "or" in the group.