Bulk Find & Replace

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




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.

Mensa Daily Puzzlers

For over 15 years Mensa Page-A-Day calendars have provided several puzzles a year for my programming pleasure.  Coding "solvers" is most fun, but many programs also allow user solving, convenient for "fill in the blanks" type.  Below are Amazon  links to the two most recent years.

Mensa 365 Puzzlers  Calendar 2017

Mensa 365 Puzzlers Calendar 2018

(Hint: If you can wait, current year calendars are usually on sale in January.)


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

bulletChange files matching a specific mask.
bulletChange a single folder or a folder and all of its sub-folders.
bulletMatch a given string and change it to a new string.
bulletMatch text case or not
bulletSimulate the "Change" runs, displaying changes to be made without updating.
bulletChange the first or all occurrences in a file.
bulletChange the first or all occurrences in each line.
bulletSave 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: May 11, 2018

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