A class designed to handle all sorts of text searches within a Document.
Search[edit]
Constructors
-
- new Search()
Creates a new Search object. The following search options are avaliable:
- needle: string or regular expression
- backwards: false
- wrap: false
- caseSensitive: false
- wholeWord: false
- range: Range or null for whole document
- regExp: false
- start: Range or position
- skipCurrent: false
Methods
-
- Search.find(EditSession session)
Searches for options.needle. If found, this method returns the Range where the text first occurs. If options.backwards is true, the search goes backwards in the session.
Arguments
| session | EditSession | Required. The session to search with |
-
- Search.findAll(EditSession session)
-
- [ Range ]
Searches for all occurances options.needle. If found, this method returns an array of Range where the text first occurs. If options.backwards is true, the search goes backwards in the session.
Arguments
| session | EditSession | Required. The session to search with |
-
- Search.getOptions()
[Returns an object containing all the search options.]{: #Search.getOptions}
Searches for options.needle in input, and, if found, replaces it with replacement.
Arguments
| input | String | Required. The text to search in |
| replacement | String | Required. The replacing text |
Returns
| String | If options.regExp is true, this function returns input with the replacement already made. Otherwise, this function just returns replacement.If options.needle was not found, this function returns null. |