

Whitespace (one or more spaces, one or more tabs, or a combination of the two). For example, ^p^# finds a paragraph that starts with a number.Ī caret (the single caret is used to identify other codes).Ī paragraph character (-not a paragraph mark). For example, ^p^t^? finds any character preceded by a tab that appears after a paragraph mark.Īny digit. Special codes for Find and ReplaceĪny single character (letter or number). You can enter them by clicking the Special button in the Find and Replace dialog box (see Figure 3-12) when the "Use wildcards" box is unchecked, but once you find how useful they are, you'll find it quicker to type them. To find special items, use the codes explained in Table 3-1. The easiest way is to search for c^$^#^#^#, which finds a C followed by any single letter and then three digits. As you can imagine, searching for "C" with "Match case" on finds me every capital C in the document. Queue a set of commands to change the font for each found item.įor (var i = 0 i < and Replace isn't flexible enough! I need to check references to a bunch of different product codes, CP408 through CQ917. and return a promise to indicate task completion.Ĭonsole.log('Found count: ' + ) Synchronize the document state by executing the queued commands, Queue a command to load the search results and get the font property values. There are special characters in regular expressions, including '', '(', ')', ') Wildcard search is essentially the same as searching on a regular expression.

One or more occurrences of the previous character or finds lot and loot. Tck finds tock and tuck, but not tack or tick.Įxactly n occurrences of the previous character or expressionĪt least n occurrences of the previous character or expressionįrom n to m occurrences of the previous character or expression Ranges must be in ascending order.Īny single character except the characters in the range inside the brackets (in)> finds in and within, but not interesting. The following table provides guidance around the Word JavaScript API's search wildcards. Corresponds to the "Use wildcards" check box in the Find and Replace dialog box. Gets or sets a value indicating whether the search will be performed using special search operators. Corresponds to the "Find whole words only" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to find operation only entire words, not text that is part of a larger word. Corresponds to the "Match suffix" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to match words that end with the search string. Corresponds to the "Match prefix" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to match words that begin with the search string. Corresponds to the "Match case" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to perform a case sensitive search. Corresponds to the "Ignore white-space characters" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to ignore all whitespace between words. Corresponds to the "Ignore punctuation characters" check box in the Find and Replace dialog box. Gets or sets a value indicating whether to ignore all punctuation characters between words. The search options are a collection of boolean values defining how the search parameter should be treated. It returns a collection of ranges which match the search text.

This function takes in a string (or wildcard expression) representing the text you are searching for and a SearchOptions object. Add-ins frequently need to act based on the text of a document.Ī search function is exposed by every content control (this includes Body, Paragraph, Range, Table, TableRow, and the base ContentControl object).
