find_whole_words_only property
FindReplaceOptions.find_whole_words_only property
True indicates the oldValue must be a standalone word.
@property
def find_whole_words_only(self) -> bool:
...
@find_whole_words_only.setter
def find_whole_words_only(self, value: bool):
...
Examples
Shows how to toggle standalone word-only find-and-replace operations.
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.writeln('Jackson will meet you in Jacksonville.')
# We can use a "FindReplaceOptions" object to modify the find-and-replace process.
options = aw.replacing.FindReplaceOptions()
# Set the "find_whole_words_only" flag to "True" to replace the found text if it is not a part of another word.
# Set the "find_whole_words_only" flag to "False" to replace all text regardless of its surroundings.
options.find_whole_words_only = find_whole_words_only
doc.range.replace('Jackson', 'Louis', options)
self.assertEqual('Louis will meet you in Jacksonville.' if find_whole_words_only else 'Louis will meet you in Louisville.', doc.get_text().strip())
See Also
- module aspose.words.replacing
- class FindReplaceOptions