Difference between revisions of "Text tools"
(22 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | {{manversion| | + | <noinclude>{{manversion|6.0.0.17|menu}}__NOTOC__</noinclude> |
− | + | {{:Enclose Selection}} | |
− | + | {{:XML/HTML Tag}} | |
− | + | <!-- ++++++++ --> | |
− | + | {{:Extract Words}} | |
− | + | <!-- ++++++++ --> | |
− | + | {{:Extended Replace}} | |
− | + | {{:Translate Characters}} | |
− | + | <!-- ++++++++ --> | |
− | + | {{:Compare Strings}} | |
− | + | <!-- ++++++++ --> | |
− | + | {{:Statistics}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 07:50, 29 June 2011
Enclose Selection.. (Alt+Ctrl+E)
Asks for two phrases and then encloses the selection with them. The first one (Before) is placed before the selection, the second one (After) is placed after the selection.
If there is nothing selected while using this tool, then the caret is placed between the two inserted strings.
TED Notepad for Windows is a freeware text editor, ... |
TED Notepad for Windows is a <b>freeware</b> text editor, ... |
Tip: This tool is most suitable for repeating phrases where only some part of those phrases varies and this variance occurs somewhere in the middle of them. Every time you need to use such phrase, either invoke this tool on empty selection and then type the varying part right in, or type the varying part first and then select it and enclose it. Remember: If there is nothing selected while using this tool, then the caret is placed between the two inserted strings.
Tip: If you need to enclose with XML or HTML tags, use the XML/HTML Tag tool instead.
Tip: If you need to enclose entire subsequent lines, it is better to select all of them at once and use Quote Lines tool (hotkey Alt+Ctrl+Q) and then Close Lines tool (hotkey Alt+Ctrl+C) instead of selecting each one of them separately and performing the Enclose Selection again and again.
See also XML/HTML Tag tool.
XML/HTML Tag.. (Ctrl+Shift+H)
Asks for a tag Name and for its Attributes. Then encloses the selection with a specified XML/HTML tag (including the attributes if given). The tag may be Empty which means that only the starting tag is generated with a slash at its end according to XML specification (e.g. <br />). In this case, if a selection is found, the tag is placed at the end of such selection.
If the selection does not contain newline, it is enclosed tightly. However, if the selection does contain newlines, it is enclosed with additional newlines after the starting and before the closing tag.
The selection always persists the operation, but it excludes the generated starting and closing tags, thus selecting the same text as before.
Note: The Persistent selection setting does not apply to this tool (as described in chapter Tools page of the Settings dialog).
There is no place like 127.0.0.1! |
There is no place like <a href="http://127.0.0.1/">127.0.0.1</a>! |
There is no place like 127.0.0.1! |
<a href="http://127.0.0.1/"> There is no place like 127.0.0.1! </a> |
Tip: If you need to enclose selection with more general phrases, use the Enclose Selection tool instead.
Tip: In Settings dialog, on the Tools page, there are options to keep or reset the Attributes and Empty fields every time the tool dialog is invoked. You can use them to support your habits or ease routines of your current tasks.
See also Enclose Selection tool.
Extract Words (Ctrl+Shift+E)
Searches the selection for words
and then transforms the selection into a complete list of all words, placing one word per line. The order of words is not changed during the transformation.
Note: All non-word characters
are removed by this tool. The original selection is replaced by the newly created list. Be careful not to accidentally destroy your document while extracting word-lists out of it.
Note: Duplicate words are not removed. Use Unique Lines tool to remove them.
There is no place like 127.0.0.1! |
There is no place like 127 0 0 1 |
See also Unique Lines tool.
Extended Replace.. (Alt+Ctrl+R)
Searches for all occurrences of a specified Find what phrase within the selection and replaces them with Replace with phrase.
By default, the search is case insensitive
. Match case option can be used to make the search case sensitive
.
Whole words option can be used to restrict the search to only those matches, which start and end at word boundaries. Note that a match itself might contain non-word characters
, since only the boundaries of the match are probed. Therefore, the last character before the match and the first character after the match may not be word characters
; while the first character and the last character of the match must be word characters
.
RegExps option can be used to turn the Regular expressions engine on. When Regular expressions are enabled, Find what is parsed as a regular expression pattern and Replace with is parsed as a replace pattern. See chapters Regular expressions and Replace patterns for more details on supported regular expressions syntax and replace pattern syntax.
Note: Invalid or faulty regular expression patterns result in tool refusing to work until the pattern is corrected.
Mimic case option can be used to mimic character case
of matches upon replacing. This option individually converts character case
of the replacement string upon each match. The conversion is done upon actual replacing (i.e. after the replacement string is prepared for the match) and the conversion takes only character case
of the match into account. Therefore, the mimic case
may result in different character case
for each match. If the tool cannot decide how to mimic case
of a match, it leaves the replacement intact, giving the user a chance to specify one special mixed case
replacement.
Tip: The mimic case
option recognizes only basic types of character case
, i.e. lower case
, upper case
, word capitals
, first capital
. Everyting else is considered mixed case
and the tool does not try to convert case of the replacement. This can be utilized to specify one mixed case
version of the replacement. Consider you need to replace OneHalf with SlovakBomber, but want to use the mimic case
to automatically replace onehalf with slovakbomber and ONEHALF with SLOVAKBOMBER. Using mixed case
SlovakBomber as a replacement will do the trick.
Escape \ button can be used to automatically escape all back-slashes in both Find what and Replace with edit fields.
UnEscape \ button can be used to remove all escapes from both Find what and Replace with edit fields.
Note: Newlines and Tab characters can be used in Find what and Replace with fields freely. Moreover, each newline from the Find what field matches any kind of newline in the document (Win/Unix/Mac). Each newline from the Replace with field is converted to the current newline type (as shown in the Status Bar for example) upon replacing.
Note: This tool is prefered to the standard Replace All mechanism from the Search and Replace in many cases. Its search is done in more feasible way and the replacing routine works much faster and uses less resources. Furthermore, the selection ensures, that the replacing is done only in the desired part of the text. And finally, one Undo step covers all replacements together, instead of grouping many small separate replacements. Although this may not be directly apparent, it is incomparably better to have one big Undo step instead of too many small Undo steps. On the other hand, if you expect only a handful of matches and replacements in a big big document, the old good looping Replace All routine might come more handy.
Note: Search patterns are limited to 64 KiB. Prior to version 6.3, search patterns were limited to 8 KiB.
Note: The tool posts Total matches
to the Status Bar.
Translate Characters.. (Alt+Ctrl+T)
Asks for Find and Translate to character maps. Then translates the characters in the selection by replacing all occurrences of each character from Find with corresponding character from Translate to.
Note that Find and Translate to represent lists of characters rather than entire phrases. By assigning the first character from Find to the first character from Translate to, the second character from Find to the second character from Translate to, etc., the tool creates a so called character translation map (similar to one used by Boy Scouts for substitution cipher encryption). With this translation map, individual characters of the selection are then substituted for other characters (as Boy Scouts are encrypting a secret message).
If Translate to is shorter than Find, extra characters from Find are translated to nothing, effectively deleting them from the results.
If Translate to is longer than Find, extra characters from Translate to are simply ignored.
Optionally, Delete all other characters option can be used to delete all characters, which are not specified in the Find. Note: Even if Delete all other characters is turned on, the translation of characters still requires that every character from Find has a corresponding character in Translate to. If Translate to is shorter than Find, extra characters from Find are again translated to nothing, deleting them from the results as well.
Optionally, Escapes & ranges option can be used to turn on recognition of character ranges within Find and Translate to.
- Character ranges allow to easily specify entire sets of characters, e.g. a-z or 0-9, without the need to enumerate all individual characters. It is important to remember, however, that each single range in Find must correspond to exactly one single range in Translate to. And corresponding ranges should be of the same length (for this purpose, even a single character is considered to be a range of one character).
- If a range in Translate to is longer than a corresponding range in Find, the overhang from Translate to is simply ignored. For example, translating a-c to 1-4 would be equivalent to translating abc to 123, the last member of the second range being ignored as overhang.
- If a range in Translate to is shorter than a corresponding range in Find, the last character from the Translate to range is repeated as many times as necessary to satisfy the orphaned characters from Find range. For example, translating a-c to 1-2 would be equivalent to translating abc to 122, the last member of the second range being repeated to fill up to the length of the fisrt range.
- If both Find and Translate to contain mix of ranges and simple characters, they are paired before the ranges are mapped to each other. For example, translating a-cde-f to 1-456 would be equivalent to translating a-c and d and e-f to 1-4 and 5 and 6, which would be equivalent to translating abcdef to 123566. This is because a-c is mapped to 1-4 ignoring the overhang; d is mapped to 5; and then e-f is mapped to 6 applying repeating of the last replacement character.
- Escapes provide an easy way to enter special characters, which are difficult to type:
- \n — newline (NL).
- \r — carriage return (CR).
- \t — horizontal tab character (TAB).
- \f — form feed character (FF).
- \a — bell character (BEL).
- \v — vertical tab (VT).
- \e — escape character (ESC).
- \0 — null character (NUL).
- \xhh — character given in hh hex notation.
- \uhhhh — character given in hhhh unicode notation (unicode version only).
- \cK — character given in control notation. The letter K can be any capital letter from A to Z, where A stands for \x00, B stands for \x01, C stands for \x03, etc.
- \\ — ordinary back-slash \ character.
- \- — ordinary dash - character.
- All other escapes are left as they appear and are considered to be two ordinary characters for user convenience. Using \? is therefore allowed and is equivalent to an escaped version \\?.
- Note: It is allowed to use escapes within ranges, i.e. it is allowed to Find range \cA-\cZ and Translate to range A-Z.
Note: Characters not specified in Find are not modified, unless Delete all other characters option is turned on.
Note: This tool is always case sensitive
. You need to specify translation for both lower case
and upper case
characters, if case insensitiveness
is expected.
TED Notepad for Windows |
Ten meteors per parsec. |
Translate Characters tool can have similar effect as, for example, All Upper Case tool:
TED NOTEPAD FOR WINDOWS |
Compare.. (Alt+Ctrl+M)
Shows the Compare Strings dialog, where two strings
can be inserted and compared. If two compared strings are not equal, beside a displayed message, the difference is marked by a selection within both strings.
Optionally, character case
can be ignored upon comparison thru Ignore case, all white-spaces
can be ignored thru Ignore spaces, and newline characters can be ignored thru Ignore newlines.
Note: Current selection (within the document) can be loaded as one of the comparison strings. Use the Load Selection 1 or Load Selection 2 to load selected document text as the first or second comparison string.
Tip: In Settings dialog, on the Tools page, there is Save strings from the dialog setting, which enables saving both comparison strings into the configuration. However, be aware that this may eventually result in bigger configuration file, if you put loads of text into the dialog.
Note: Only the first 64 KiB are stored into the config to prevent long application initialization times. Prior to version 6.3, text stored into the config was limited to 8 KiB.
Statistics.. (F9)
Shows the Statistics dialog with computed statistics about the document and the selection. Statistics include several types of counts of characters, words, lines, sentences and paragraphs; minimum, maximum and average line lengths; etc.
Note: Statistics are computed separately for the document and for the selection.
Note: Description of terminology used in the Statistics dialog can be found in the section Appendix, including exact definitions.
Tip: The Statistics dialog supports accelerators for easy access. Note: You may need to hold down the Alt key to make them appear.