I'm looking for a desktop "Regular Expression 'Scripting' Tool" for Windows.
I have been using Replace Text but there are issues with it in the non-standard way it handles Regex strings. Here are some of them:
It doesn't support
"^"
or"$"
for anchoring your search to the beginning or end of a line, so you have to search for "newlines" surrounding a line.It uses a non-standard token to represent "newlines" (etc ...), so there is some translation required to get working Regex Search and Replace strings to work.
By default, all searches are "case-sensitive". For non-regex (plain text) searches, you can specify "case-insensitive" searches, but for "Regex", all searches are "case-sensitive".
The
"."
(dot) is handled differently than normal in that"."
always matches a "newline", further complicating translation of working Regex Search and Replace strings.
Aside from these issues (and some others), it works fairly well, and it has some nice features, but it is always a problem to translate a Regex string that you have composed and tested somewhere else, to work with this tool.
To use the tool, you specify a pair of strings: a Regex search string and a Regex replacement string. You can specify as many of these pairs of strings as you want.
You also specify your input filename (or multiple files using wildcards like "*.txt"
) and if you want the output files to get new names or overwrite the input files (and some other options).
Then you run the tool and the set of Regex's is "applied" to the file (or each file in a set of files), and the resulting output is written to the file (files) that you specified.
So, I'm looking for a similar tool, that can process one or more files, and apply one or more Regex search/replace operations on each file.
I'm looking for a desktop tool (not online) that at least works on Windows 7, and uses at least one (more is better) standard Regex syntax, and includes the ability to do both case-sensitive and case-insensitive searches.
I'd prefer a free tool (as in free beer), but I'd be interested in hearing about outstanding purchased solutions for the future.
Edit:
Steve Barnes asked about a GUI which I should have mentioned above...
If the tool has GUI, that's fine, but I'd like to be able to use the tool to process files from the command prompt (or batch script).
Currently, using the "Replace Text" tool mentioned above, I generally use its GUI to define the fileset, path, options, etc..., and then I save the configuration to a "control" file that the tool will use when it's run to process the files. Then I manually add/edit the Regex strings in that file. For simple tasks, I just copy and edit an existing "control" file and change the path/filenames and Regex strings. Then, from the command prompt (or batch script), I run the tool and pass it command line options to tell it to use the information in the "control" file to process the files and then exit.
A recommended replacement tool does not have to work exactly this way, and doesn't need to have a GUI.
I'd like to be able to specify the Regex search/replace strings in a file, and then pass the name of that file to the tool to process the file. If I had to pass the literal Regex strings to the tool on the command line it would be an issue because it would be difficult to pass 50 or 100 or perhaps more Regex string pairs on the command line, and particularly since quoting would likely be a complication. If I had to pass the path/filenames to the tool on the command line, that would work fine.