PowerFind gives you powerful yet easy-to-use tools that extend the Normal Find and Replace functions in Nisus Writer Pro. There may be times when you need to find or replace text which conforms to a complex description or which varies from place to place in your document. For example, to find and highlight every paragraph that contains a semicolon. Searches of this type would be impossible using conventional find-and-replace methods, but are quite simple using PowerFind. In general, anything you can describe in words, you can find with PowerFind.
Everything you’ve learned about finding and replacing text with Normal Find applies to PowerFind. In addition, what you learn about PowerFind serves as the basis for the more advanced PowerFind Pro.
In this part of the documentation, you’ll learn what types of tasks you can do with PowerFind. You’ll also find complete instructions for using both methods, along with plenty of examples of useful “find” expressions for your convenience.
PowerFind is easy to use, and performs all the complex find and replace procedures available in PowerFind Pro. PowerFind is “Menu” or “Browser” driven. You can type real words in the PowerFind text edit box, but all of the power of PowerFind comes from the Find/Replace menus or Browser, which are available from the “Gear” button and the Show PowerFind Browser… command at the bottom of its menu in the Find & Replace window as illustrated in Figure 401 on page 460.
In PowerFind Pro you can enter the same expressions as with PowerFind, but you can also use the keyboard to enter them.
When the Find & Replace window is in PowerFind mode the expressions of the PowerFind Browser enter the Find & Replace window as “bubbles”.
When the Find & Replace window is in PowerFind Pro mode the expressions of the PowerFind Browser enter the Find & Replace window as text.
Use PowerFind to increase your productivity and simplify tedious writing and editing procedures. Here are just a few ways to use PowerFind
• find all telephone numbers or addresses—even if they’re not all in the same format
• find all UPPERCASE or Capitalized words.
• change the sequence of words
• to find all underlined words
As you experiment, always remember to back up your document before trying any new procedure.
You may have already used Nisus Writer Pro’s standard Find and Replace feature to perform simple substitutions—for example, replacing one word with another throughout your document. Sometimes, however, you need more flexibility in what you search for, or you may want to do more complex substitutions. PowerFind allows you to include variables, and parenthesized expressions in your Find Expression to narrow the search down to exactly what you want. Should you reach the limits of PowerFind’s flexibility, you can move on to PowerFind Pro for virtually unlimited find and replace capability.
This section has an example to show you how easy it is to use PowerFind to find phrases that contain variables. It also explains the parts of a find expression and the logic Nisus Writer Pro follows to complete a find procedure. In the example, you’ll also convert the PowerFind expression that defines the search to a PowerFind Pro expression. This step gives you an idea of the difference between these two search types.
A good understanding of the terms and concepts described below will help you learn to use PowerFind (and, later, if you want, PowerFind Pro) more effectively.
A metacharacter is a PowerFind command or symbol.10 Metacharacters denote a specific character or set of characters and can represent variables, number of repetitions, and so on. PowerFind displays the metacharacter symbols in a user-friendly manner using natural language words and phrases in a “bubble”. You can customize the color of these bubbles in your Appearance Preferences.
Figure 399
A PowerFind metacharacter or “bubble”
PowerFind finds literal text exactly as it is entered. Literal text means characters that have no special meaning on their own (that is, they are not “meta” “characters”). The PowerFind mode considers all text to be literal; it will find exactly what you type.
An expression consists of one or more metacharacters, literal text, or any combination of metacharacters and literal text used to define or describe what you want to find. Which is why we say at the beginning of this section that “If you can describe it, you can find it, and if you can find it, you can change it to anything else you can describe.”
A wild card is a metacharacter that assumes the identity of one or more characters in a search expression. For example, the wild card in Figure 399 looks for any digit.
The PowerFind Find expression illustrated in Figure 400 first looks for an open parenthesis, then the string of characters “part number” followed by a space and any sequence of one or more digits then a close parenthesis.
Figure 400
A simple PowerFind expression
Suppose you want to find all the capitalized words in your document. You can quickly create a PowerFind expression that will find all words beginning with any capital letter in a single step—regardless of how many letters are in the word or what the letters are. And if you want to be more specific—say, finding all capitalized words except those beginning with P, you can easily convert your PowerFind expression to a PowerFind Pro expression and make the needed adjustments. For instructions on how to convert PowerFind expressions to PowerFind Pro expressions see page 463.
Use the “Find what” and “Replace with” menus
The Find what and Replace with menus present all the basic find and replace commands you might need to combine to create your Find or Replace Expression. In addition they contain submenus containing recently found and replaced expressions, as well as saved expressions, along with the tool to save them.
► Choose the commands you need from the Find what Gear pop-up menu or the Replace with Gear pop-up menu.
This puts the “metacharacters” that represent the expression in the Find what and Replace with text edit boxes.
Figure 401
The Find & Replace window’s Find What menu
The PowerFind Browser is a floating window. It functions much as the Finder browser window. When you select from the commands on the left, new options become available in the columns to the right from which you can select more options.
☞ While it may appear to be a bit unwieldy, the PowerFind Browser is very useful because it can give you an explanation of what each metacharacter means. As you become more comfortable building your Find and Replace expressions, you may wish to use the menus as you graduate to PowerFind Pro.
1. Open the Find & Replace window by choosing the menu command: Edit > Find > Show Find….
2. Choose Show PowerFind Browser… from the Find what Gear pop-up menu or the Replace with Gear pop-up menu.
In addition to PowerFind Commands (as with the menus), the browser keeps track of Recent Find Expressions, Recent Replace Expressions and even Saved Expressions that you may have used at an earlier (no longer recent) session and decided to save.
Nisus Writer Pro groups the PowerFind expressions into five sub-sets Special Positions, Wild Card, Match, Special Characters, and Repeat. When you choose an option from any of these columns, Nisus Writer Pro inserts a graphic representation of the corresponding option in the Find what or Replace with box.
The PowerFind Browser opens so that you can see all three columns of PowerFind expressions available. Below these expressions, two other areas appear
Repeat or Found #
These options only appear for two Find expressions (N - M Times and N Times of the Repeat options) and in the Match expression OtherFound, or in the Replace expression OtherFound. An example appears in Figure 405 on page 464.
Description This area displays the selected PowerFind expression both in its PowerFind "bubble" as well as its PowerFind Pro text form. It also includes a brief description of what the expression would find.
► Drag the lower right corner of the window to make the window larger or smaller.
Figure 402
The PowerFind Browser
Find capitalized words (a PowerFind example)
1. Open the document you need to revise and move the insertion point to the beginning of the document or type the following into a new document
I went for a walk along the Atlantic City boardwalk and thought about all I had missed. A few hours earlier she had asked me to join her for a trip across New Jersey through Pennsylvania, Ohio, Indiana, the great Midwest and over the Rockies to the Pacific Ocean in California.
Then complete these steps.
2. Choose the menu command: Edit > Find > Show Find…, then choose the menu command: Gear > Show PowerFind Browser… beneath Find what.
The PowerFind Browser window opens to offer more capabilities.
3. Select PowerFind Commands from the PowerFind column, then Wild Card from the PowerFind Commands column and then UppercaseLetter from the Wild Card column to find strings of characters that begin with a capital letter.
You can double-click UppercaseLetter or select it and click Insert.
Or
◦ Choose the menu command: Find what > Wild Card > UppercaseLetter inside the Find & Replace window to find strings of characters that begin with a capital letter.
☞ As you insert the expression, the Using pop-up menu automatically switches from Normal Find to PowerFind.
4. Select Wild Card from the PowerFind Commands column and then Select LowercaseLetter from the Wild Card column to tell PowerFind that the word you’re looking for may contain some lowercase letters after the initial capital letter.
You can double-click LowercaseLetter or select it and click Insert.
Or
◦ Choose the menu command: Find what > Wild Card > LowercaseLetter inside the Find & Replace window.
5. Select Repeat from the PowerFind column, then 0+ from the Repeat column.
You can double-click 0+ or select it and click Insert.
Or
◦ Choose the menu command: Find what > Repeat > 0+ inside the Find & Replace window.
We know that most words have more than one lowercase character.
6. If it is checked, be sure to uncheck Ignore Case. Otherwise Nisus Writer Pro will find all words whether they are capitalized or not.
Figure 403
Building the PowerFind expression
7. Click the Find Next button to begin the search.
Nisus Writer Pro can find all capitalized words, one at a time.
Select all instances of a found expression at once
► Click the left side of the Find All button.
Display all matches in a new window, including their context
► Click the right side of the Find All button (the “Share” icon, the little square with the arrow emerging out of its top).
Nisus Writer Pro opens a Find Results window as illustrated in Figure 391. The window floats above any open document window and is a variant of the Find & Replace window… specific to that particular Find operation. You can keep any number of Find Results windows open for various documents
Convert a PowerFind expression to a PowerFind Pro expression
► Choose PowerFind Pro (regex) from the Using pop-up menu.
Do this for its learning value. While you can perform many functions with the menus of PowerFind, the ability to write your expressions directly gives you much greater flexibility.
The expression in the Find what box now looks like this
[[:upper:]][[:lower:]]*
Notice how PowerFind Pro uses symbols in place of the graphic representation of the menu commands. You’ll learn what these and other PowerFind Pro symbols mean in the section beginning on page 478.
☞ You can convert PowerFind expressions to PowerFind Pro, but, you cannot convert PowerFind Pro expressions back to PowerFind.
Here are a few hints to keep in mind when working with PowerFind.
• Replace expressions must be unique. Any “Wild Card”, “Repeat” or the “Space or Tab” metacharacters cannot be used in a Replace with expression, because they are not unique. On the other hand, a Replace with expression can contain metacharacters like
Or
Because they always mean the same thing.
• If the search doesn’t work as expected, look over the options selected in the Find & Replace window (for example, Whole Word and Entire File). Also verify the position of the insertion point.
Use Match menu commands to match phrases found in Find and Replace expressions.
Or Appears only in the Find what variant of the Match menu and matches any characters on either side of the Or expression.
Capture() Causes the matched text it encapsulates to be available as one of the 'Captured' items either later in the search string or in the replace string. This expression is valid only in the search string, not in the replace string.
Found Appears only in the Replace with variant of the Match menu and represents whatever have been selected by Capture().
Captured1 - Captured10
Corresponds to that numbered portion of the Find expression (built within parentheses), use in both Find and Replace expressions. Nisus Writer Pro supplies the individual commands for 1 through 10. If you have additional encapsulated captured matched text you need to use OtherCaptured.
OtherCaptured
Corresponds to that numbered portion of the Find expression (built within parentheses), use in both Find and Replace expressions.
FollowedBy() and PrecededBy()
Neither FollowedBy() nor PrecededBy() “capture” anything. Think of them as a nested expression (or perhaps a “grouped”, “sub”, or “contained” expression). These each require that the nested expression be present, but the content itself is not included (that is “captured”) in the match. In other words, they are zero-width and do not contribute to the full match. They function like the start/end of line anchors (“$” and “^”) but allow somewhat arbitrary expressions. Only FollowedBy() allows arbitrary expressions. PrecededBy() requires the subexpression to be fixed in width, or some combination of fixed width expressions.
As an example, let’s say you want to find the last word in any sentence, but don’t want to select the punctuation mark itself. You could use the expression illustrated in Figure 404. The FollowedBy() verifies that the word is FollowedBy() a punctuation mark, but does not include that mark in the match.
PrecededBy() is the same, but it verifies the nested expression exists before the following expression, rather than after.
Figure 404
The “FollowedBy” PowerFind expression
Figure 405
The OtherCaptured PowerFind expression
NotFollowedBy() and NotPrecededBy()
Similar to FollowedBy() and PrecededBy() neither NotFollowedBy() nor NotPrecededBy() “capture” anything. Think of them as a nested expression (or perhaps a “grouped”, “sub”, or “contained” expression). These each require that the nested expression to not be present. In other words, they are zero-width and do not contribute to the full match. They function like the start/end of line anchors (“$” and “^”) but allow somewhat arbitrary expressions. Only NotFollowedBy() allows arbitrary expressions. NotPrecededBy() requires the subexpression to be fixed in width, or some combination of fixed width expressions.
CharacterInSet[] Any one or more characters, for example: vowels
CharacterNotInSet[]
Any one or more characters, for example: anything not a Tab
Use the Repeat set options to find a character or wild card that appears a specified number of times. To find parts of strings, be sure to uncheck Whole Word. You cannot use Repeat options in the Replace expression. To replace something you find with a certain number of items in the Replace box you must enter them that many times. (Remember, you can cut copy and paste in the Find & Replace window.)
Repeat menu commands refer to repeated occurrences of a character or wild card. Zero or one occurrences means that the character or string is either not found or found only once; there is no repeat. For example, the expression (find any A followed by any B which may or may not be there), finds each occurrence of A alone or A preceding any number of B’s.
The expression illustrated in Figure 406 (find any A or any A followed by any B but only the first one that appears) finds A in AC and AB in ABB.
Figure 406
The “0 or 1” PowerFind expression
0 or 1 Shortest
Zero or one occurrence, the shortest occurrence
The expression illustrated in Figure 407 (find any A followed by any B which must be there at least one (or more) time(s), but only the shortest string of them) finds only AB regardless of how many B’s appear.
Figure 407
The “0 or 1 Shortest” PowerFind expression
0+ Zero or more repeated occurrences (“It may or may not be there.”)
0+ Shortest Zero or more repeated occurrences (“It may or may not be there.”), the shortest occurrence
1+ One or more repeated occurrences
The expression illustrated in Figure 408 (find any A followed by any B which must be there at least one (or more) time(s)).
1+ Shortest One or more repeated occurrences, the shortest occurrence
Figure 408
The “1+” PowerFind expression
N Times Exactly “N” repeated occurrences
N - M Times
Between “N” and “M” repeated occurrences
The expression illustrated in Figure 409 (find any A followed by any B which must be there between 3 and 5 times; using N - M Times) finds ABBB, ABBBB and ABBBBB only.
Figure 409
The “N - M Times” PowerFind expression
☞ Note that the Repeat refers only to the immediately preceding character or variable.
As explained in “Finding and/or replacing non-Roman characters” below, you can look up the Unicode blocks for specific scripts in the Characters palette (choose the menu command: Special Characters > Show Character Catalog… at the bottom of the Edit menu, choose Code Tables from the View pop-up menu inside the Characters palette) as illustrated in Figure 410, and enter them directly in a PowerFind Pro expression.
Block” is merely a named contiguous code point range, while a “script” is a property of each code point. Often times code points in the same block will have the same script, but there is no hard rule on this. A“
Nisus Writer Pro does, however, include metacharacters for a wide variety of scripts and blocks. If you are familiar with code blocks, these are all fairly self explanatory and are, thereby, listed here without much further explanation.
AnyArabic, (including Persian/Farsi) AnyCyrillic (i.e. Russian, Bulgarian, etc.), AnyDevanagari, AnyGreek, AnyGujarati, AnyGurmukhi, AnyHan (Chinese, both Traditional and Simplified as well as Japanese Kanji), AnyHangul, AnyHebrew (Any character in Hebrew characters, whether Hebrew, Ladino, Yiddish or related languages), AnyHiragana, AnyKatakana, AnyLatin (Romanic script or the vast majority of European languages or transliterations into those languages), AnyThai Any character in Thai, InAlphabeticPresentationForms, InArabic, InArabicPresentationFormsA, InArabicPresentationFormsB, InArmenian, InArrows, InBasicLatin, InBengali, InBlockElements, InBopomofo, InBopomofoExtended, InBoxDrawing, InBraillePatterns, InBuhid, InCherokee, InCJKCompatibility, InCJKCompatibilityForms, InCJKCompatibilityIdeographs, InCJKRadicalsSupplement, InCJKSymbolsAndPunctuation, InCJKUnifiedIdeographs, InCJKUnifiedIdeographsExtensionA, InCombiningDiacriticalMarks, InCombiningDiacriticalMarksForSymbols, InCombiningHalfMarks, InControlPictures, InCurrencySymbols, InCyrillic, InCyrillicSupplementary, InDevanagari, InDingbats, InEnclosedAlphanumerics, InEnclosedCJKLettersAndMonths, InEthiopic, InGeneralPunctuation, InGeometricShapes, InGeorgian, InGreekAndCoptic, InGreekExtended, InGujarati, InGurmukhi, InHalfwidthAndFullwidthForms, InHangulCompatibilityJamo, InHangulJamo, InHangulSyllables, InHanunoo, InHebrew, InHighPrivateUseSurrogates, InHighSurrogates, InHiragana, InIdeographicDescriptionCharacters, InIPAExtensions, InKanbun, InKangxiRadicals, InKannada, InKatakana, InKatakanaPhoneticExtensions, InKhmer, InKhmerSymbols, InLao, InLatin1Supplement, InLatinExtendedA, InLatinExtendedAdditional, InLatinExtendedB, InLetterlikeSymbols, InLimbu, InLowSurrogates, InMalayalam, InMathematicalOperators, InMiscellaneousMathematicalSymbolsA, InMiscellaneousMathematicalSymbolsB, InMiscellaneousSymbols, InMiscellaneousSymbolsAndArrows, InMiscellaneousTechnical, InMongolian, InMyanmar, InNumberForms, InOgham, InOpticalCharacterRecognition, InOriya, InPhoneticExtensions, InPrivateUseArea, InRunic, InSinhala, InSmallFormVariants, InSpacingModifierLetters, InSpecials, InSuperscriptsAndSubscripts, InSupplementalArrowsA, InSupplementalArrowsB, InSupplementalMathematicalOperators, InSyriac, InTagalog, InTagbanwa, InTaiLe, InTamil, InTelugu, InThaana, InThai, InTibetan, InUnifiedCanadianAboriginalSyllabics, InVariationSelectors, InYijingHexagramSymbols, InYiRadicals, InYiSyllables
Finding and/or replacing non-Roman characters
Specify which Script (“language”) your text is in by choosing the appropriate language from the Scripts / Blocks set or:
1. Choose the menu command: Edit > Special Characters > Show Character Catalog… to open the Apple-supplied Characters palette as explained in “Enter Unicode text” on page 716 to find non-Roman characters.
2. In step 2 of the instructions there, instead of inserting the character in your document you will insert it into the Find or Replace window.
☞ This is not the “Character” palette that is part of Nisus Writer Pro, which has controls for the font and other character formatting of your text.
Figure 410
The System's Characters Catalog (Viewer)
Use options from the Special Characters set to find spaces, tabs and other similar “formatting” and other special characters.
Space Space character; an invisible character that appears when you press the Space Bar
Tab Tab character; an invisible character that displays on your screen when you press the Tab Key (⇥)
Space or Tab Space character or a Tab character
Return The Return character; an invisible character that defines the end of a paragraph
Soft Return The Soft Return character; an invisible character that defines the end of a line without beginning a new paragraph
Use options from the Special Positions set to determine the location of the beginning or ending of the Find expression.
Start of Word Matches the start of any word.
The expression illustrated in Figure 411 would find any word that begins with a “g”.
Figure 411
The “Start of Word” PowerFind expression
End of Word Matches the end of any word.
The expression illustrated in Figure 412 would find any word the ends with a “g”.
Figure 412
The “End of Word” PowerFind expression
Start of Paragraph
Matches the start of any paragraph, except when that paragraph is at the beginning of a new section.
End of Paragraph
Matches the Return character ((i.e. Carriage Return) from Classic Mac documents), Newline (Mac system/Unix) or carriage Return and Newline (Windows). While technically the traditional term for this is End of Line, because it does not select the Soft Return character Nisus Writer Pro uses the layperson’s term. End of Paragraph also matches the end of the document, even if it does not end with a Return character.
Start of Sentence
Matches the start of any sentence.
End of Sentence
Matches the end of any sentence.
You can see how some of these Special Positions metacharacters function in Figure 413 below. The expression finds all words that both begin and end with “g” and appear at the end of a sentence (going, gag, gong and gang), while ignoring all other words that either begin with but do not end with a “g” (got, garage and good), as well as all words that both begin and end with “g” but do not appear at the end of a sentence (Greg, as well as other instances of gang, gong and gag).
Figure 413
Special Positions set of Find/Replace expressions illustrated
Include a wild card in your expression when you want to find one or more characters. For example, use the wild card
To look for any number between 0 and 9. If you know you want to find 93, type 9 and 3 in the Find box. If you just know that your document has a two digit number, but you don’t know what it is, enter
Any Any group of characters (except footnote references), including the Return character that defines the end of a paragraph.
AnyText Any group of characters (except footnote references), excluding the Return character that defines the end of a paragraph.
AnyCharacter Any character including the Return character that defines the end of a paragraph, only one (can be modified using the options of the Repeat set)
AnyTextCharacter
Any character excluding the Return character that defines the end of a paragraph, only one (can be modified using the options of the Repeat set)
AnyWordCharacter
Any single alphanumeric character; excluding Returns spaces, punctuation, characters; this is part of the Unicode specifications
AnyLowercaseLetter
Any lowercase letter from a to z, excluding modified letters (such as ñ, ç or ü)
AnyUppercaseLetter
Any uppercase letter from A to Z, excluding modified letters (such as Ñ, Ç or Ü)
AnyDigit Any numeric character that serves exclusively as a digit: 0-9 as well as other characters from languages with distinctive characters for numbers, e.g.: Arabic: ۱, ۲, ۳
AnyLetterOrDigit
Any alphabetic or numeric (“alphanumeric”) character; this is the old "POSIX" style character class
Any Whitespace
The Space character; a Tab, a Return, a Soft Return and a Page Break
Any Space Any single space character; a normal space, non-breaking space, etc. including the Word Joiner (Zero Width Non-Breaking Space) U+2060.
Any Break The Page Break or Section Break; an invisible character that results from choosing Page Break or any of the various section breaks from the menu command: Insert > Section Break
AnySentence Any group of characters that ends in an “end of sentence” marker followed by a space (tab, Return or the end of the file). If a space follows an abbreviation with a period, Nisus Writer Pro selects up to that period.
AnyParagraph Any character that occurs one or more times (from the insertion point forward) except the Return character that defines the end of a paragraph
AnyHTMLTag
Any group of characters surrounded by “<” and “/>”.
Any Double Quote
Matches any double quote ("), opening or closing, “smart” or "straight".
Any Single Quote
Matches any single quote ('), opening or closing, ‘smart’ or 'straight'.
Any Currency Matches any currency symbol such as $, ¢, £, ¥, €, ₪, ฿, ƒ, ₥, ﷼, ₨, ₩.
Any Symbol Matches any single symbol character (math, dingbats, currency, etc).
Any Punctuation
Matches any punctuation character such as the “period”, “comma”, !, ?, [ and other brackets, etc.
Any Private Use Area
Matches any single character in Unicode’s Private Use Area (PUA), which is reserved for application/domain specific characters. Eg: these character codes are not standardized and could be used for any purpose.
The Transform set of metacharacters available in the Gear submenu of the Replace with portion of the Find & Replace window enable you to “transform” “captured” UPPERCASE characters to lowercase, “captured” lowercase characters to UPPERCASE, and Capitalize any “captured” expression.
Lowercase{} Causes any captured text to be transformed to the lowercase version of those characters
Uppercase{} Causes any captured text to be transformed to the UPPERCASE version of those characters
Capitalize{} Causes any captured text to be transformed so that the first letter of each captured string of characters is capitalized.
☞ “Words” with non-alphabetics in them for example “guinea-bissau” “r2d2” “find/replace” “nisus.com” and even possessive forms such as “wagner’s” become transformed to: “Guinea-Bissau” “R2D2” “Find/Replace” “Nisus.Com” And “Wagner’S”.
Examples of putting PowerFind to use
In the examples that follow, all instructions assume the Find & Replace window is open and PowerFind is selected from the Using pop-up menu.
These steps explain how to find every blank line and remove it.
1. Choose Return twice from the Special Characters set, then 1+ from the Repeat set.
The Find box displays this expression in Figure 414.
Figure 414
The “Find 2 or more Returns” PowerFind expression
2. Click in the Replace with box and choose from the Gear menu: Special Characters > Return.
3. Choose from the Where pop-up menu: Entire File.
4. Click the left side of the Replace All button to remove all blank lines.
You can insert forced page breaks in your Nisus Writer Pro documents by choosing the menu command: Insert > Page Break. You can also find and remove them using PowerFind.
1. Click in the Find what box and choose from the Gear menu: Special Characters > Any Break.
2. Leave the Replace with box blank.
3. Click the left side of the Replace All button to remove all page breaks created using the menu command: Insert > Page Break.
☞ Beware! This removes all inserted breaks, page breaks as well as section breaks.
Change the sequence of a pattern
These instructions explain how to change all occurrences of a date entered as dd/mm/yy (for example 23/06/73) to mm/dd/yy. (or 06/23/73).
1. Click in the Find what box choose from the Gear menu: Match > Capture().
2. Be sure your insertion point is between the two portions of the “Capture” metacharacter.
3. Choose from the Gear menu: Wild Card > AnyDigit twice.
4. Type a slash:
/
So far, the Find expression is as illustrated in Figure 415.
Figure 415
The “Capture any two digits followed by a slash” PowerFind expression
1. Select what you see in the Find what box, then choose Copy then Paste it in twice.
2. Delete the final slash “/” to finish the expression so that it appears as illustrated in Figure 416.
Figure 416
The “Capture any two sets of digits separated by slashes” PowerFind expression
Here each set of the Capture and AnyDigit represents the two digits of the month followed by the slash “06/” then the day and slash “23/” and finally the year “73” the three things you want to find and switch.
☞ Not only can you resize the Find & Replace window, but, if some of the expression is still hidden, a scrollbar appears.
3. Click in the Replace with box and choose from the Gear menu: Match >
b. Type a slash:
/
d. Type a slash:
/
The Replace Expression should appear as illustrated in Figure 417.
Figure 417
A PowerFind replace expression changing a sequence of captured text
Nisus Writer Pro uses the found text it “Captured” to define the numbered Captured groupings; that is, the first set of Captured text surrounds what will be produced in “Captured1”. The “Capture” stores the found expression so that it can be recalled when using the numbered Captured characters in the Match. In this example, the first Capture defines the two numbers, found in the text, not the symbols AnyDigitAnyDigit, to be recalled when Captured1 is used.
So, in the example, Captured2 represents the day (now at the beginning) and Captured1 represents the month (now appearing in second place).
4. Choose from the Where pop-up menu: Entire File.
5. Click the right side of the Find All button.
6. Click the right side of the Replace All button.
Find two neighboring duplicate paragraphs
This exercise uses the PowerFind Browser rather than the menus of the Gear menu in the Find & Replace window.
1. Make sure your insertion point is in the Find what text box of the Find & Replace window, and it is empty.
2. Choose from the Gear menu: Show PowerFind Browser….
3. Double-click PowerFind > Match > Capture().
4. Place your insertion point between the two portions of the “Capture” metacharacter, if it is not already there.
5. Double-click PowerFind > Wild Card > AnyParagraph.
6. Double-click PowerFind > Special Characters > Return.
So far, the Find expression appears as illustrated in Figure 418.
Figure 418
The “Capture any paragraph followed by a return” PowerFind expression
7. Place your insertion point to the right of the close parenthesis of the “Capture” metacharacter.
8. Double-click PowerFind > Match > Capture1 so that Find what window appears as illustrated in Figure 419.
Figure 419
The “Capture any paragraph followed by a return ’repeated once’” PowerFind expression
9. Double-click PowerFind > Repeat > 1+ so that the final Find Expression appears as illustrated in Figure 420.
Figure 420
The “Capture any paragraph followed by a return ’repeated once’ one or more times” PowerFind expression
You can use this expression to find and eliminate repeated paragraphs.
Change the wording of a repeated phrase containing a variable
Suppose your document contains multiple entries of the phrase “whose widget code number is #,” where # represents any of fifty different widget codes. The Find and Replace expressions below change this phrase to “with widget code #” without changing actual numerical values.
► Create the Find and Replace expressions illustrated in Figure 421.
Figure 421
A PowerFind expression that changes the wording of a repeated phrase with a variable
With your document open choose the menu command: Edit > Find > Show Find…. The following steps will lead you through the process of creating the Find what and Replace with expressions illustrated in 1.
1. Choose PowerFind from the Using pop-up menu.
2. Choose the menu command: Gear > Match > Capture() inside the Find & Replace window.
3. Make sure your insertion point is inside the parentheses of the Capture expression and choose the menu command: Gear > Wild Card > AnyCharacter inside the Find & Replace window.
4. Choose the menu command: Gear > Repeat > 1+ inside the Find & Replace window.
5. Press ⇥ to move your insertion point from the Find what text box to the Replace with text box of the Find & Replace window.
6. Type the opening HTML tag you want.
The tag illustrated is
<i>
7. Choose the menu command: Gear > Match > Found (this time beside the lower Gear, beneath Replace with) inside the Find & Replace window.
8. Type the closing HTML tag you want.
The tag illustrated is
</i>
9. Press ⇥ once again to select all the “text” in the Find what text box.
10. Apply the formatting you want to find (that match the HTML tags you’ve entered) from the Format menu.
11. Test your find/replace expression by clicking Find Next and then Replace a couple of times.
12. Now that you’re confident the pattern works correctly, click Find All to replace all matches.
13. If you want to save the find and replace pattern for later you can use the macroize feature as explained in the section Create a macro from Find and Replace expressions
1.
The Find & Replace window with the find and replace expressions
Previous Chapter Normal Find |
<< index >> |
Next Chapter PowerFind Pro |