Bulk Find & Replace

[Home]   [Puzzles & Projects]    [Delphi Techniques]   [Math topics]   [Library]   [Utilities]

 

Search

Search WWW

Search DelphiForFun.org

As of October, 2016, Embarcadero is offering a free release of Delphi (Delphi 10.1 Berlin Starter Edition ).     There are a few restrictions, but it is a welcome step toward making more programmers aware of the joys of Delphi.  They do say "Offer may be withdrawn at any time", so don't delay if you want to check it out.  Please use the feedback link to let me know if the link stops working.

 

Support DFF - Shop

 If you shop at Amazon anyway,  consider using this link. We receive a few cents from each purchase.   Thanks.


Support DFF - Donate

 If you benefit from the website,  in terms of knowledge, entertainment value, or something otherwise useful, consider making a donation via PayPal  to help defray the costs.  (No PayPal account necessary to donate via credit card.)  Transaction is secure.

Contact

Feedback:  Send an e-mail with your comments about this program (or anything else).

Search DelphiForFun.org only

 

 

I recently discovered that a number of the Delphi programs on my home computer had the "Range checking" compiler option enabled.   Range checking is a useful debugging tool when mysterious errors occur during testing.  The cause is frequently that some array that has exceeded it's bounds and overwritten some other part of the program's data or code.  Range check immediately stops and warns when this occurs.  So it's handy and effective, but also has a large performance impact since every data change is tested before being applied.  My general intent is "range checking on" during testing but "range checking off" in the final product.  Now if only I can remember to turn it off!

That situation was the motivation for this program.  Each Delphi project had an associated  configuration text file with a .cfg extension which, among other things, sets every compiler option including range checking. The range check line is -$R+ for checking on and -$R- for checking off.   Running this program against .cfg files changing $R+ to %R-  scanned 1800 projects here and found 240 with "Range Checking" turned on!  I have not analyzed results yet, but I know that many of these are still in my "Future Projects" folder and others are leftover test versions which may have had the option turned off in the final posted version.  Applying the changes where appropriate will be my next project. 

In the meantime, I made the Bulk Find Replace program generalized with these options and  features

  • Change files matching a specific mask.
  • Change a single folder or a folder and all of its sub-folders.
  • Match a given string and change it to a new string.
  • Match text case or not
  • Simulate the "Change" runs, displaying changes to be made without updating.
  • Change the first or all occurrences in a file.
  • Change the first or all occurrences in each line.
  • Save options when program closes and reload load at next startup.  A Test.txt file is included in the downloads for initial testing.

July 17, 2015:  I just discovered  that the original program version did not correctly search or replace text in files formatted with wide (Unicode) strings.  Version 2 posted today will correctly find and replace characters or strings for files with ANSI or Unicode strings. 

Let me know if you find it useful (or especially if you find bugs!) .

Download executable

Download source
 

Created: March 14, 2013

Modified: February 18, 2016

  [Feedback]   [Newsletters (subscribe/view)] [About me]
Copyright 2000-2017, Gary Darby    All rights reserved.