|
|
Regular expressions Dialog Box |
Compare It! can use regular expressions (RE) to ignore some parts of text strings. For example, using regular expressions, you can define rules to ignore the first 10 characters or line numbers, if they are included. Compare It! will search for defined regular expression text and replace it with other text. Note that this operation will not change your file, it will only affect internal text used for the comparison.
See Using Regular Expressions for additional information about regular expressions.
How RE can affect comparison.
RE can be applied by several rules:
- Replace - simple search and replace is done;
- Ignore string with match - whenever match will be found in string, full string will be ignored during comparison;
- Cut file after match - whenever match is found in line, file loading is stopped. Note that unlike other methods, this will affect how document will look on the screen.
- Ignore lines between R1 and R2 - file is processed normally until string matching R1 (search RE) is found. Then all strings are ignored, while line matching R2 (replace RE) is not encountered
- Ignore lines matching R2 after R1 - file is processed normally until string matching R1 (search RE) is found. Then all consecutive strings, matching R2 (replace RE), will be ignored. Line that doesn't match R2 will stop the rule.
- Ignore lines not matching R1 - only lines, matching search RE, will be used for comparison; all other lines will be ignored. This rule is opposite to Ignore string with match
- Automatch rule - unlike other actions, this one can be used to visually align lines automatically by selected keywords. See details.
You can select desired rule while creating regular expression.
To define a regular expression
- Choose .
The Options dialog box appears.
- In the Options box, click Comparison.
- Select the Use Regular Expressions check box and click the browse (...) button next to the check box.
The Regular expressions dialog box appears.
- In the Items box, click .
- In the Name field, type a name for the regular expression.
- In the Search field, define a regular expression to find in every text line in the file.
Note: The background color of this field will change to red if your regular expression is not formed correctly.
- In the Replace field, define the text to replace the found sub-string.
You can also leave this field empty to simply remove the matching sub-string.
- In the Files field, enter a file mask to use for the regular expression.
You can also use the select button (>>) to select from predefined file types.
- Select the Use only once check box to apply the regular expression rule only once to each string.
This means that after RE is found and replacement is done, string will not be changed by same rule anymore. If this option is not set, string would be searched for next occurence of RE.
This is important for regular expression rules that replace text at the start of lines.
- Finally, set appropriate replace action for RE - this will affect how it will be used during comparison. See actions description above
- Click the Close button.
Note: If regular expressions were applied to the file, appears at the right in the title bar of the source or target pane.
To remove a regular expression
- Choose .
The Options dialog box appears.
- In the Options box, click Comparison.
- Select the Use Regular Expressions check box and click the browse (...) button next to the check box.
The Regular expressions dialog box appears.
- In the Items box, select the name of the regular expression to remove and click .
- In the Name field, type a name for the regular expression.
- Click the Close button.
Once you have defined regular expressions, you can enable or disable them for specific comparisons.
To enable or disable a regular expression
- Choose .
The Options dialog box appears.
- In the Options box, click Comparison.
- Select the Use Regular Expressions check box and click the browse (...) button next to the check box.
The Regular expressions dialog box appears.
- In the Items box, select the name of the regular expression to enable or disable and click the appropriate check box at the bottom of the dialog box: click the selected check box to enable the regular expression, or click the clear check box to disable the regular expression.
- Click the Close button.
|