Thursday 12 May 2011

How To Replace Text Using Notepad

Notepad is the default text editor that comes shipped with most—if not all—versions of Windows. Usually called Notepad.exe or simply notepad, this application is a small footprint program with a basic feature set.

Some hardcore programmers actually still use Notepad to edit code, although the feature set is very basic. For practical purposes, Notepad is straightforward enough for use when editing simple text documents, reading “readme” texts, and editing Windows system files, such as the Hosts file, Config files, INI files, and the like.

While a simple application, Notepad does have its extra features, which include some formatting (word wrap vs no word wrap) and search functionality. Notepad’s search function has proven to be useful when finding an exact string of text within the text currently being edited. Some added features include addition of the current date and time.

The most useful feature for any text editing application, though is the search and replace function. In Notepad, this function can be accessed using either the menu system or through shortcut keys.

Accessing Replace Text: Menu vs Shortcut. The easiest way to access the Replace functionality with Notepad is through the menu. Here are your options:

* With your mouse, click Edit, then Replace. The Replace window will then appear.
* You can also use keyboard shortcuts for the menu. Press Alt-E to bring up the Edit menu. Then press R to bring up the Replace menu.
* You can use an easier shortcut. Press Ctrl-H to bring up the replace menu. Note that Ctrl-H is a common shortcut for the “Replace” functionality in many other text editors and word processors, such as Microsoft Word and Windows WordPad.
Using the Replace function. The Notepad Replace function is not as advanced as those on MS Word or WordPad, which let you define formatting and other options. You will see the following fields:

* “Find What” field is where you need to place the text you want to replace. If you have selected a string of text before hitting Ctrl-H, this text will automatically be copied to the “Find What” field.
* “Replace With” field is the string you will want to replace the original text with. Remember to input the actual text you want to replace the original text, including the cases.
* The “Match case” checkbox needs to be checked if you want Notepad to be exact in its search. Otherwise, the replacement command will be case insensitive.


You can click the Replace button to replace the next instance of the text you are looking for. If you are sure you want to replace everything, you can press the Replace All button instead. As shortcuts, you can press Alt-R to replace the next instance, or Alt-A to replace everything.

Notepad will start its search-and-replace action from the point where the cursor is currently located, and will end the action where the document ends. For best results, do your search-and-replace command with the cursor at the top of the document, so that Notepad will replace everything.

No comments:

Post a Comment