Usually additional whitespace does not result in a significant change.
I am having problems with Replacements. For example, I have a replacement defined with the "replace with" text set to:
AND c_timestamp = @c_timestamp
On the right-hand side of the compare, some files have additional whitespace around the equal sign. If the "text to find" on the left was actually replaced with the "replace with" text, then the only difference between the left and right sides would be whitespace, and the lines would be considered similar. In replacements, however, a difference in whitespace makes the change significant.
I understand that replacements expects a 1-to-1 match with the text in the right pane, but this discrepancy still feels wrong.
Suggestion:
Why not programatically create a regular expression from the "replace with" text as follows...
...then, when the "Text to find" is found on the left hand side, evaluate the right hand side to see if the programatically created "replace with" regular expression exists and, if so, change the resulting text to blue instead of allowing whitespace differences to cause a replacement to appear as a significant change.
I am having problems with Replacements. For example, I have a replacement defined with the "replace with" text set to:
AND c_timestamp = @c_timestamp
On the right-hand side of the compare, some files have additional whitespace around the equal sign. If the "text to find" on the left was actually replaced with the "replace with" text, then the only difference between the left and right sides would be whitespace, and the lines would be considered similar. In replacements, however, a difference in whitespace makes the change significant.
I understand that replacements expects a 1-to-1 match with the text in the right pane, but this discrepancy still feels wrong.
Suggestion:
Why not programatically create a regular expression from the "replace with" text as follows...
- Substitute [ /t]* for whitespace next to a delimiting character
- Substitute [ /t]+ for whitespace not next to a delimiting character
- Convert any special characters to their regular expression equivalents (such as [[] for [ and [\]] for ] and [(] for ( and [)] for ) etc.)
...then, when the "Text to find" is found on the left hand side, evaluate the right hand side to see if the programatically created "replace with" regular expression exists and, if so, change the resulting text to blue instead of allowing whitespace differences to cause a replacement to appear as a significant change.
Comment