The Define Substring dialog is available from the Advanced Find & Replace dialog.
When a text block is found (using Advanced Find and Replace dialog), you can extract up to three sub-strings from that text and store them in $A$, $B$ or $C$ special variables. The sub-strings can then be reinserted back into the replacement text. Example: Replace text = '<a $A$>'. Hep will refer to $A$ only, however this dialog is also used when editing $B$ and $C$ substrings.
[New for FAR HTML 5] FAR 5 introduces the $A*$ command. It uses the same $A$ definition (that you setup using this dialog), however if your replace text contains $A*$ instead of $A$ here's what happens... Where $A$ is a substring extracted from the current match string, $A*$ is a substring string extracted from the current file.
This is an important concept to grasp. $A$ is recalculated on every search match -- The $A$ substring is extracted from the matching text result. But $A*$ is recalculated once as each file is loaded (The recalculation rules defined using this dialog).
The rest of this help topic describes $A$. But please remember $A*$.
Note: Some text entry fields are greyed. This indicates that they contain no text and will not contribute to the search. They are not disabled. As soon as you type in text they will become un-greyed and contribute to the search.
The Advanced Find and Replace dialog has just found a match string. Now we must define a substring and place the result into $A$. If no match is found then $A$ remains empty.
Let's say we are performing an Advanced Search and Replace matching on strings
like <a href="http://helpwaregroup.com" target="_blank">. Using substrings we can extract just the link text into $A$.
$A$.Find Substring No#: 1
$A$.between start text: href="
$A$.and end text: "
$A$.Result should include Start/end text: NO
Thus $A$ will contain the text: http://helpwaregroup.com
and the Advanced Replace text may now be defined as say '<a href="$A$">'
Thus the objective was to simplify all anchor tags.
This section performs a mini find and replace on the $A$ substring created in the section above.
Let's say we have an Advanced Find and Replace matching all <a ...> tags. So let's use $A$ to remove all target="*" text from the <a ...> tags while preserving all other text in the <a ..> tag.
$A$.Find Substring No#: 1
$A$.between start text: '<a '
$A$.and end text: '>'
$A$.Result should include Start/end text: 'NO'
If the Advanced Find and Replace match was <a href="http://helpwaregroup.com" target="_blank">
then $A$ will now contain the text: href="http://helpwaregroup.com" target="_blank"
Lets now delete the target="_blank" part.
$A$.Delete text starting with: target="
$A$.Ending with: "
$A$.Replace deleted text with: <empty string>
$A$.Delete mode: Normal
Thus $A$ now contains <a href="http://helpwaregroup.com">. The target info has been removed.
Back in the Advanced Find and Replace dialog we can now set the replace text = <a $A$>