RegEx Search and Replace

regexcropThis tool uses the Microsoft VB Scripting RegEx control to allow searching and optionally replacing text using regular expressions. Regular expressions allow searching for patterns instead of just specific text. See Wikipedia and Regular-Expressions.info for more details. Different RegEx implementations use varying syntax. The allowed syntax is displayed in the main window of this utility.

Portability

This utility is portable–meaning it can be run without installation, such as from a memory stick. Just copy regex.exe after installation, or extract the file from the setup executable using an unzip tool.

Source Code Notes

The source code included with this tool has a VB6 User Control I created as a wrapper for the VB TextBox control to remove the 32K text limit. This could easily be copied to your own project if you need long text but do not want to use the RichText control. The source CTL and CTX files are used so they will compile as part of the application EXE, but you could also compile it into an ActiveX control. Not all textbox properties and events are implemented, but you can easily add more.

Downloads

1.1.3 5/9/2012 Fixed Find button selecting text before the first match
Fixed negative column numbers
1.1.2 4/21/2011 Fixed out of bounds error when replacing text in long documents
Fixed underscored link on help page
1.1.1 11/4/2010 Fixed horizontal scrollbar getting cut off for Regular Expression Syntax
Added prompt to save before closing
Added Find Previous button
Added Edit menu with clipboard actions and Select All feature.
Added help page
1.1.0 4/3/2008 Removed 64K limit on search text length.
Added file open/save actions. Increased font sizes.
Find text now shows previous 20 searches in a dropdown list. Ctrl-A can now be used to select all text in any textbox.
Fixed problem with match count getting cut off for large numbers of matches.
Added line, column, and search text length counters.
A file or text can now be displayed by dragging it from another application and dropping it on the search text box.
The syntax text can be hidden to reduce the window size.
Settings are now saved in an INI file (default) or in the registry (Options menu).
1.0.1 7/22/2008 Replace text can now be multiline
1.0.0 Original Release