find(text: String; (JadeRichText) start: Integer; finish: Integer; options: Integer): Integer; find(match: String; (JadeTextEdit) range: Integer; direction: Integer; caseSensitive: Boolean; wholeWord: Boolean; wordStart: Boolean; interpretation: Integer): Integer;
The find method returns the character position at which the text was found. If no match was found, this method returns -1.
The find method of the JadeRichText class searches for text within the contents of the control. The find method parameters for rich text controls are listed in the following table.
Parameter | Description |
---|---|
text | Text to be located. |
start | Start of the search range, as a character index into the text or specified as Find_BeginningOfText. |
finish | End of the search range, as a character index into the text or specified as Find_EndOfText. |
options | One or more of the following values, separated by the plus symbol (+). |
|
|
|
|
|
|
|
The find method of the JadeTextEdit class searches for text within the contents of the text editor. The find method parameters for text edit controls are listed in the following table.
Parameter | Description |
---|---|
match | Mandatory value, which specifies the text to be located. |
range | Range of search. One of FIND_RANGE_ALL (0), FIND_RANGE_CARET (1), or FIND_RANGE_SELECTION (2). |
direction | Direction in which to search. Specify -1 to search backwards towards the top of the text, zero (0) or +1 to search forwards towards the bottom of the text. |
caseSensitive | If true, finds only text with the matching case. If false, the search is case-insensitive. |
wholeWord | If true, finds only whole words. If false, finds parts of words that satisfy the search. |
wordStart | If true, the match must occur at the start of a word (that is, the matched text must be preceded by a non-word character). |
interpretation | One of the following values, represented by JadeTextEdit class constants. |
|
|
|
|
|
|
|
For JadeTextEdit controls, the matching text is selected in the text editor and the caret is positioned at the end of the matched text (that is, the selection).
Characters that have special meaning within a regular expression for interpretation represented by the JadeTextEdit class FIND_INTERP_REGEXPR constant are listed in the following table.
Character | Description |
---|---|
. | Matches any character. |
\( | Marks the start of a region for tagging a match. |
\) | Marks the end of a tagged region. |
\n | The n value in the range 1 through 9 refers to the first through ninth tagged region when replacing. For example, if the search string is Fred\([1-9]\)XXX and the replace string is Sam\1YYY, when applied to Fred2XXX, this generates Sam2YYY. |
\< | Matches the start of a word using Scintilla's definitions of words. |
\> | Matches the end of a word using Scintilla's definition of words. |
\x | Enables you to use a character x that would otherwise have a special meaning. For example, \[ is interpreted as [ and not as the start of a character set, and \\ means a single backslash character. |
[...] | Indicates a set of characters; for example, [abc] means any of the characters a, b, or c. You can also use ranges; for example, [a-z] for any lowercase character. |
[^...] | Complement of the characters in the set. For example, [^A-Za-z] means any character except an alpha character. |
^ | Matches the start of a line (unless used inside a set, as stated for [^...] in the previous row). |
$ | Matches the end of a line. |
* | Matches zero or more times. For example, Sa*m matches Sm, Sam, Saam, Saaam, and so on. |
+ | Matches one or more times. For example, Sa+m matches Sam, Saam, Saaam, and so on. |
A regular expression can also contain the escape sequences listed for FIND_INTERP_UNSLASH, except for \xHH. The find method returns -1 if the match text is an invalid regular expression (for example, an unbalanced [).