import * as vscode from 'vscode'; // Get the active text editor const editor = vscode.window.activeTextEditor; if (editor) { // Get the find model bound to the editor model const findModel = vscode.editor.contrib.find.findModel.FindModelBoundToEditorModel.get(editor); // Set the find options (regular expression search, case sensitivity) findModel.revealResults = true; findModel.isRegex = true; findModel.matchCase = true; // Find matches in the editor findModel.find('example'); // Get the search ranges for the matches const searchRanges = findModel.getSearchRanges(); // Replace the first match with a new string findModel.replace(searchRanges[0], 'replacement'); }In this example, we first import the TypeScript module and get the active text editor. We then use the FindModelBoundToEditorModel class to get the find model associated with the editor and set some find options. We then find matches for the string "example", get the search ranges for those matches, and replace the first match with a new string. This module is part of the built-in extension API for Visual Studio Code, which is included in the vscode module.