Search window within the B(PN)² editor
The user can enter the search term.
The direction of the search can be specified.
The behaviour of the search algorithm is controlled by some options:
-
- Either the search stops at the end of the text or it is continued at the beginning.
-
- The search algorithm accepts regular expressions.
Replace window within the B(PN)² editor
The user can enter a term that is to be replaced.
The user can enter the term that will be inserted instead.
The direction of the search can be chosen.
The behaviour of the search algorithm is controlled by some options:
-
- Either the search stops at the end of the text or it is continued at the beginning.
-
- The search algorithm accepts regular expressions.
Regular expressions
A powerful way to express a search string is by specifying a regular expression. It has a general pattern specification syntax including the ability to extract substrings from the matching string. A pattern is a sequence of a literal character, a matching character, a repetition clause, an alternation clause, or a sub-pattern grouped by parentheses. The syntax (which is not necessarily the most convenient one, but which is predetermined by Tcl/Tk) is summarized in the following:
- .
- Matches any character.
- *
- Matches zero or more characters. (Repetition operator)
- +
- Matches one or more characters. (Repetition operator)
- ?
- Matches zero or one character.
- ()
- Groups a sub-pattern. Subsequent repetition operators or enclosing alternation operators apply to the whole sub-pattern.
- |
- Alternation operator.
- []
- Delimits a set of characters. Ranges are specified as x-y. (E.g. [ae-g] searches for a , e , f or g ). If the first character (after the opening braket) in the set is ^, then there is a match if the remaining characters (whithin the brackets) are not present. (E.g. [^ae-g] searches for characters that are not equal to a , e , f or g ).
- ^
- Represents the beginning of a line. (Only when it is the first character of the search string.)
- $
- Represents the end of a line. (Only when it is the last character of the search string.)