Left Quotation MarkRight Quotation Mark

The MadCap Column In this regular column, Adrian Morse provides tips for complex searches in Flare.

Download Article
MadCap Icon
Communicator Spring 2013 cover

Flare's Find and Replace window enables you to easily search for text in your projects. However, finding entities such as tables, graphics, highlighting, variables and conditions is not so intuitive. Table 1 shows how to perform such searches. (For all searches the Find in source code check box must be selected.)

Backing up prior to replace operations

Table 1 includes tips for globally replacing code. You should back up your project prior to performing any such operations.

Regular expressions

Besides the operations shown in the table you can use regular expressions to perform find operations, (see https://en.wikipedia.org/wiki/Regular_expression).

Although Flare enables you to use regular expressions in the Find what field, it does not support regular expression ‘backreferences' in the Replace with field. You can only replace a found string with a standard string. For example, you cannot remove tags around text while leaving the text between the tags intact. To do this use a third-party tool such as Microsoft® FrontPage® or FAR® HTML.

Pre-loading the 'Find what' list

When a Flare project is opened, the last 15 searched terms appear in the dropdown list of the Find what field (the list is not project-dependent). You can easily create a Windows registry file to pre-load the list with search terms that are hard to remember. Then, whenever you want to refresh the list you just close Flare, double-click the registry file and restart Flare.

Note: You do not need administrative rights to run the registry file because it only acts on the HKEY_Current_User part of the registry.

Caution: Take great care when working with the Windows registry as incorrect edits can leave your system totally unusable.

The safest procedure for creating the registry file is as follows:

  1. In any Flare project, search one by one for up to 15 terms in the Find and Replace window.
  2. Open the registry. (Windows 7: Click the Start button and type regedit in the ‘Search programs and files' field; other systems: consult the system help file).
  3. Find the key: HKEY_CURRENT_USER\
    Software\MadCap Software\
    FindAndReplaceDialog version.1\
  4. Right-click Values_mWord, select Export, choose a name and location for the registry file and click OK.
  5. Close the registry.

Any user can now pre-load the Find what list by double-clicking this registry file.

Table 1. MadCap Flare Find scenarios

To do this: …enter this search term
(change the text in bold according to your project)
Find manually applied highlighting background-color: This will only detect manually applied background colour; it will not detect any colour that is applied by a stylesheet for example, shaded boxes for notes.
Find a specific highlight colour background-color: #Hexadecimal code for the colour; Examples: Yellow: #ffff00 Green: #00ff00 Blue: #00ffff Pink: #ffb6c1 You can see the hexadecimal code for any colour by looking at the RGB column in the Color Picker:

You can also find the colour of a particular instance of highlighting using the Pick Screen Color command.
Find and remove a specific highlight colour style=“background-color: Hexadecimal code for the colour;
Example: style=”background-color: #ffff00” REPLACE: Replace with blank (not a space) Note: There could still be some undetected highlighting in situations where there is additional character formatting for example:
style=”font-style: italic;background-color: #ffb6c1;” To remove such instances, you must perform an additional find/replace as follows:
FIND: background-color: Hexadecimal code for the colour; Example: background-color: #ffff00; REPLACE: Replace with blank (not a space)
(Note: It is important to perform the two find/replace
operations in the order specified)
For entire paragraphs that are highlighted this method will remove all trace of the original highlighting code. However, if only part of a paragraph is highlighted this method will leave behind empty <span> tags. These will not affect the project outputs, and can be safely left alone. That said, if you prefer to remove these, you can do so easily using a thirdparty tool such as Microsoft FrontPage or FAR HTML (www. helpwaregroup.com/products/far)
Find any condition MadCap:conditions=
Find a particular condition ConditionsFile.ConditionName
Example: Default.PrintOnly (Note: Do not include the expression ‘MadCap:conditions' in the search as this will not find any instances where the condition exactly overlaps with another condition.)
Because condition tags can overlap it is not safe to use Replace functionality to remove conditioning; you might remove the wrong end tag.

However, you can safely use Replace functionality to change the condition that is applied to text. (If you have overlapping conditions, using Replace can result in the same condition overlapping itself in the code but this will not affect the way the text appears in the XML Editor or the output.) For example, in versions prior to V8, editing the name of a condition in the Conditions file breaks all links from topics to that condition; this find/replace method enables you to repair such breaks.
Find any variable <MadCap:variable name=
Find a particular variable <MadCap:variable name=”VariableFile.VariableName” />
Example: <MadCap:variable name=”MyVariables.Phone” />
You can safely use Replace functionality to remove all occurrences of a variable (replacing the Find expression with blank). You can also use it to change one variable file/ name to another, or to change a variable to text (replace the entire Find expression with the text you want). For example, in versions prior to V8, editing the name of a variable in the Variables file breaks all links from topics to that variable; this find/replace method enables you to repair such breaks.
Find any table <table  
Find tables with a specific table style class=“TableStyle-TableStyleSheetNameExample: class=”TableStyle-IndentedTable01” If you want to change the stylesheet used by tables, the safest way is via the Apply Table Style window rather than using Find/Replace functionality (see the Flare help file for more information).
Find a particular bookmark <a name=”BookmarkName”> Example: <a name=”PatientChartSection”> If you remove or edit a bookmark any links pointing to it will be broken.
Find any image <img

Adrian Morse is Documentation Manager at Picis, a US-based provider of Healthcare software.