Programming and design: Andrew Shelkovenko.
RQ Search and Replace
is a shareware
software. Homepage -
http://miraxem.com
You can download the latest version of RQ Search and Replace from
http://miraxem.com/rqsr.zip
or http://mirasea.com/rqsr.zip
Documentation -
http://miraxem.com/
helpe.zip
What's new
Batch search and replace in MS Word documents
supports now !!!
Important note!
To provide search and replace
operations in MSWord documents be sure that you close MS Word application !!!
Also set menu "View as" in "Plain text" mode !!!
Introduction
The program RQ Search and Replace is used to search and replace
multiple text fragments in several files simultaneously.
Search and replace patterns are stored in the search and replace table.
You don't need to fill the table manually. It is possible to open required file in the
built-in editor, select a text fragment and copy&paste it into the table.
The table can store multi-line text blocks. Use search editor and replace
editor fields to add or edit multi-line text blocks in the search and
replace table.
Here are key features of
Screenshot of main Window

Quick start
1).Select a folder where SEARCH &
REPLACE operations should occurs by clicking
on the Folder button in the upper right hand
corner.
To specify only certain file types use the pull-down menu just
below it.
If you want to include the subfolders that are below the specified folder
click on the Include subfolders checkbox and
select which subfolders you want to include in the Search & Replace operations.
2) If you want to open a specific file in the Build-In editor... double click on one of the files listed in the File List box (right hand panel).
3) Click on the cell in the first row of the "Find What" column and either... manually enter the text that you want to find or drag and drop from the Build-In editor.
4) Click on the cell in the first row of the "Replace With" column and either... manually enter the text that you want to replace the found text with or drag an drop from the Build-In editor.
5) Click on the cell in the first row of the "Object" column and select from the pull-down menu... what type of object to Search for.
6) Click on the cell in the first row of the "Mode" column and select from the pull-down menu... what type of mode to use for the Replace operation.
7) Repeat steps 3 - 6, in the next row down of each column... if you want to add more Search & Replace operations.
8) Put a checkmark in the "!!!" column, of each row, that you want to perform when you click the Start button.
9) When you are ready to begin the Search & Replace operation... click on the Start button on the right hand side of the screen.
10) If the results, of the Search & Replace operation, are incorrect... select from the Backup menu, one of the Restore options.
Objects list
1. Text block - single or multi-line text block.
2. Text string - text block separated by CR+LF or LF
symbols
3. Whole word - whole word is part of text enclosed one of the
following chars -
cr,lf,./\| !@#$%^&*()+=-?><~`;:[]{}'
4. HTML tag.
5. Enclosed block
-
Enclosed block is part of text enclosed in specified chars
sequences ("brackets").
6. MS Word objects - text, special symbols, hyperlinks.
Following operations are supported:
For Text block, Whole word, Enclosed block.
Replace - replacement of text block in
selected files
Delete - deleting of text block in selected files
Insert before - inserting "replace pattern" before
"search pattern"
Insert After - inserting "replace pattern" after
"search pattern"
For
MS Word objects
Replace
For strings
Replace - replacement of all strings, that
contains "search pattern", by the "replace pattern"
Note, that full string will be replaced by "replace
pattern"
Delete - deleting all strings that contains
"search pattern"
Insert before - inserting "replace pattern"
before string that contain "search pattern"
Insert after - inserting "replace pattern" after
string contained "search pattern"
("replace pattern" can contain empty line for adding string before or after
search pattern)
For HTML tags
Delete tag - deleting all
tags that contains "search pattern"
Change attribute
Delete attribute
Add attribute - Add the attribute with given value. If
attribute already exists - just set the new attribute value.
In upper case - set attribute value to upper case for attributes listed
in replace cell only.
In lower case-
set attribute value to lower case for attributes listed in replace cell only.
You can search for files within the specified Path.
You should also specify mask. All files from the specified Path conterminous
with the specified mask are processed. The manual search and editing of the
loaded file is possible.
Objects description
1. Text block.
Text block is simple characters flow "as is".
Set Block object type in object column of search/replace table
For example (in square brackets)
[ple characters flow "a]
- single line text block.
[ search for files within the specified Path. You should also specify mask.
All files from the specified Path conterminous with the specified m] -
multi-line text block .
You can add and edit single- or multi-line text block in the search/replace
table
using the search or replace table editors fields.
The found text block will be replaced by the text block from the Replace
cell of the table.
2. Text string
Set String object type in object
column of search/replace table
Text string is part of text enclosed by CRLF or LF chars. When you press Enter
in text editor CRLF chars added to the text and new string created.
For example:
Search cell contains pattern [color].
Replace cell contains pattern [there was color].
a). The Mode cell contains [Replace]
Program search all string that contains pattern [color], as
1
</div></span></ilayer></layer></iframe></noframes></style></noscript></table></script></applet></font>
2
<body bgcolor="#FFFFFF" text="#000000"
link="#295181" vlink="#295181" alink="#660000">
3
<font color=#00ffff>BS_FLAT</font>
4
<style>
and then replace this strings by strings [there was color]. (full text from
Replace cell)
2 and 3 lines contains pattern [color]
and will be replaced
Result is:
1
</div></span></ilayer></layer></iframe></noframes></style></noscript></table></script></applet></font>
there was color
there was color
4
<style>
b). The Mode cell contains [Delete].
2 and 3 lines contains pattern [color] and
will be deleted
Result is:
</div></span></ilayer></layer></iframe></noframes></style></noscript></table></script></applet></font>
<style>
c). The Mode cell contains [Insert before]
Result is:
</div></span></ilayer></layer></iframe></noframes></style></noscript></table></script></applet></font>
there was color<body bgcolor="#FFFFFF"
text="#000000" link="#295181" vlink="#295181" alink="#660000">
there was color<font color=#00ffff>BS_FLAT</font>
<style>
d). The Mode cell contains [Insert after]
Result is:
</div></span></ilayer></layer></iframe></noframes></style></noscript></table></script></applet></font>
<body bgcolor="#FFFFFF"
text="#000000" link="#295181" vlink="#295181" alink="#660000">there was color
<font color=#00ffff>BS_FLAT</font>there was color
<style>
Note, that no strings added to text, just the replace pattern added
to beginning or ending of found strings (i.e. strings, that contains search pattern)
To add a new string you need add clrf characters to replace pattern.
3. Whole word
(Set Wholeword object type
in object column of search/replace table)
Whole word is part of text enclosed one of the following chars -
cr - carriage return
lf - line feed
,./\| !@#$%^&*()+=-?><~`;:[]{}'
ht - hot tab
Usually whole word is part of text
enclosed by spaces.
4. HTML tag.
(Set
HTML tag object type in object column of
search/replace table)
HTML tag is char sequences, similar to
<[ ]tag name[ ]attribute name[ ]=[ ]attribute value[
][...] >
[ ] - one or more white spaces
attribute name and attribute value is
optional
[...]
-
repeat (attribute name[ ]=[ ]attribute
value[ ]) sequence.
Program search tags by search condition and changes
found tags.
Tags search conditions.
You can set the tag search conditions next :
1. Tag
Equivalence
Program searches for the same tag with the same attributes set.
Attributes order in tag, spaces are ignored.
In search cell you need insert tag and
EQU key, separated by <>
For example:
In search cell:
<IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous Page"><>EQU
All found tags with the same 5 attributes will be changed.
If you insert in search cell tag without attributes - all the same
tags without attributes will be found and changed.
2. AND condition
Program search the same tag, and it
must contains all attributes from search cell + any other attributes.
In search cell you need insert tag and And
key, separated by <>
For example:
In
search cell:
<IMG
WIDTH = 32 HEIGHT =
32 BORDER = 0 ALT="Previous Page">
<>And
All found tags, that contain this 4 attributes will be changed.
<IMG SRC="bluprev.gif"
WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous
Page">
or
<IMG SRC="rev.gif"
WIDTH = 32 HEIGHT = 32 BORDER = 0 ALT="Previous
Page" >
but not
<IMG SRC="bluprev.gif"
WIDTH =
62 HEIGHT =
32 BORDER = 0 ALT="Previous Page">
WIDTH =
62 not
WIDTH = 32
<IMG SRC="bluprev.gif" WIDTH = 32 HEIGHT =
32 BORDER = 0 >
attribute ALT="Previous Page" not
presents.
If you insert in
search cell tag without attributes - all the same tags with ANY
attributes will be found and changed.
3. OR condition.
Required tag should comprise even one
of attributes of search - attribute with the same value.
In search cell you
need insert tag and OR
key, separated by <>
.
For example -
<script defer =1234><>OR
If you insert in search cell tag without attributes - all the
same tags with ANY attributes will be found and changed.
4. And-NOT condition.
Required tag should NOT comprise NOT
every of attributes of search - attribute with the same value.
In search cell you
need insert tag and NOT
key, separated by <>
If you insert in search cell tag without attributes - all the same
tags with ANY attributes will be found and changed.
5. Not -OR condition
Required tag should NOT comprise even
one of attributes of search - attribute with the same value.
In search cell you
need insert tag and NOR
key, separated by <>
For example -
<script defer =1234><>NOR
6. By default search condition is OR
Tag operations
Next tag operations are possible:
1. Delete tag
| Replace cell content - (delete keys) | Operation |
| Empty (by default) | delete start tag and corresponding end tag |
| ALL | delete start tag, corresponding end tag and all text (and other tags) enclosed in this tag. |
| ALL - | delete only text enclosed in this tag. |
You can choose delete keys from drop-down list in replace
cell. Select cell, then click on the cell again and click on appeared
arrow.
Change attribute
1. In search cell insert tag with attribute that need be changed.
2. Program search tags by search condition.
3. In found tag program search attribute by its name.
4. If attribute present - program change attribute value by value from replace
cell.
For example
| Search | Replace |
| <meta http-equiv="Content-Type"> | charset=windows-1251 |
Result:
Ex.1
Old tag <META http-equiv="Content-Type" content="text/html">
New tag <META http-equiv="Content-Type" content="text/html">
No changes, because no charset attribute presents.
Ex.2
Old tag <meta
http-equiv="Content-Type" charset=windows-1250>
New tag <meta
http-equiv="Content-Type" charset=windows-1251>
Charset attribute value changed by value from replace cell
2.
Replace attribute - value of attribute is
replaced on given.
More in detail.
1. Searched tag, satisfying to a condition of search
2. In found tag the attribute is searched, which name coincides with given in a
cell of replacement.
3. Set attribute value to the given in a replacement cell
For example 1.
Search cell <meta
http-equiv="Content-Type">
Replace cell charset=windows-1251
Will be search tags
meta,
contains attribute http-equiv="Content-Type" and if tag contains also
attribute
charset, then charset value will
be set to
windows-1251
For example 2.
Search cell
<meta charset=windows-1251><>AND
Replace cell charset=koi8-r
Will be search tags
meta,
contains attribute charset=windows-1251
and attribute
charset value will be set to
koi8-r.
3.
Delete attribute
4. Add attribute
Add the attribute with given value. If attribute already exists - just set
the new attribute value.
5. In upper case - set attribute value to
upper case for attributes listed in replace cell only. If in replace cell char *
presents - set all attribute value to upper case.
6.
In lower case
Note.
1. Double (and more ) white spaces replace by single spaces.
2. Quotes and apostrophes is equal
i.e. attribute values
onClick="this.setHomePage('http://www.ru');
return false;"
onClick='this.setHomePage("http://www.ru"); return false;'
onClick=this.setHomePage('http://www.ru'); return false;
is equal.
5.
Enclosed block
Enclosed block is part of text enclosed in specified chars
sequences ("brackets"). This "brackets" can be multichars.
Program search first sequence ("bracket") , then second "bracket" and
change text block between last char position of first bracket and first char
position of second bracket.
For example:
First bracket is AAA char sequence.
Second bracket is BBB char sequence.
All text is
1234AAAmy textBBBnot
my text
Program found that my text is appropriated to
search terms.
If there are many "brackets" in text:
1234AAAmy AAAAA teBBBx
zzzzAAAAAzzz tBBBnot
me text
Program found that my AAAAA
te is first appropriated block and AAzzz t
is second appropriated block.
You can use the second bracket the same as first bricked.
For example:
First bracket is AAA char sequence.
Second bracket is AAA char sequence too.
In this case:
1234AAAmy qAAAAA
teBBBx zzzzAAAAAzzz tBBBnot me text
the first appropriated block is my q
the second appropriated block is AA teBBBx zzzz
For delete mode you can set search pattern in replace cell. If
pattern is contained in found "enclosed block" - this block will be
changed.
For example:
Note.
When Enclosed block object type selected two fields added to Search cell.
| Search | Replace | |
| AAA | BBB | ZZZ |
Line1
AAAwwwwwwBBB
Block wwwwww will not be deleted, because it not contain pattern ZZZ
Line2 AAAww bzzzBBB
Block
ww
bzzz
will be deleted,
because it contain pattern ZZZ
Example of Search and replace table

6.
Regular expression
Regular expressions is a power and
flexible instrument to search and manipulate text.
See detailed description in
http://en.wikipedia.org/wiki/Regular_expression
To use it in Rq search and replace just set
object
as
regexp
and
mode
as
replace.

7. MSWord
objects
You can use text blocks, words, special characters or wildcards, hyperlinks.
Select from Object column drop-down list "MSWord" item and then
click on Object or Mode cell.
Next window will be showed.

This window is similar to Find and Replace
window in MSWord.
You can test search pattern using MSWord
and then paste it in "Find what" and "Replace with" in this window.
You can copy and paste multiline text from MSWord and then press "Fill from
clipboard" button.
Formatted text will be converted into plain text with special symbols and fill
out to focused field "Find what" or "Replace with"
Hyperlinks.
In MSWord documents hyperlinks usually seems like this
OldHyperLink <msword.htm>
where OldHyperLink is Text-To-Display property
then white space as delimiter
and msword.htm is Address property in < >
brackets
you can input hyperlink manually or copy-paste it from MSWord document.
1. Open MSWord document.
2. Select hyperlink in document. Right click on it - in popup menu click
"Copy Hyperlink", (NOT single "Copy" menu item !!!)
3. Open RQSR and Set "Object" in search-replace table - select "MSWord" in
drop-down list.
4. Then click on "Mode" cell - "MS Word search and Replace property" window
appears.
5. Select "Find What" field in this window and click on "Fill from clipboard"
button - copied hyperlink will pasted in this field.
for example
OldHyperLink <msword.htm>
6. Select "Replace with" field in this window and click on "Fill from clipboard"
button again - copied hyperlink will pasted - edit hyperlink as you wish.
for example
New HyperLink <C:\bas\RapidQ\_word\msword.htm>
7. Set "Hyperlink" radio button.
Hyperlinks will be replaced, not simple text.
Set Hyperlink Name and\or Hyperlink Address checkboxes.
Set Whole Hyperlink checkbox.
You can separately change Hyperlink Name and\or Hyperlink Address or part of
it.
8 Click "Add to grid" button - data will be added in Search-replace table (see
row 1 in the table)
9. Set check box (green) in "!!!" column. Only checked rows will used.
10. Fill 2nd etc rows similarly.

WildCards.


You can open MSWord document in build-in
editor.
Use menu View as - As is. Then double click in document file in the right file
list and select Open in popup window.
Document will be opened in build-in
editor. You can select and
copy-paste text.
To save changes press Ctrl-S.
Important note!
To provide search and replace
operations in MSWord documents be sure that you close MS Word !!!
Also set menu View as in Plain text mode !!!
1. Specify a file or files
This panel allows to explore the folders, to view and to edit
list of files to process. Press the button
to explore and select the folders.
Select file mask.
![]() |
--
select folder -- select or type new mask of the files to show on the Folders panel. -- create the file list including files in subfolders. When checked, File List window will be opened. (See below). All checked files from this list will be processed. You can exclude some files by unchecking.
|
When "Include subfolders" is checked
File List window will be opened.
Subfolders separated by background colors.

Also you can select file mask by mouse right button click
![]() |
Choose extension.. - view file with extension as highlighted file Only this file - view only highlighted file Refresh file list - refresh file list |
By pressing the button
you can open a directory tree panel to choose the
folders. The "hot" directories can be chosen and kept in the appropriate combo
box.

The chosen file can be started (if it has registered type) by double click on a line with a name of a file under the menu.

2. Insert the patterns into the
search and replacement string table.
Choose required operations - Replace, Delete etc, and objects - block,
string, whole word etc.
|
Only checked lines will processed
in operations of search and replacements. |

To fill the string table is possible by different ways.
Select cell in the table (yellow highlight appears)

Then use Menu Grid-Import

If you choose "Fill search column from current file by strings" - this importing file will loaded into the "Find What" column line-by-line (1-4 lines on picture)

![]() |
For manual
search in the editor text input search pattern into
a field and press the button Search.
If the input field is empty, the fragment of the text which is taking place in the table editor will be searched. The result of search will be displayed in the editor of a file by highlighting of the found fragment. To begin search and replacement process press the Start button. If the data in the string table of search and replacement are incorrect, the warning message will be showed. The process of search can be stopped, having pressed the button Stop. This button can be used and in other cases, for example for a stop of loading of the very large file etc.
|
| The results of search process are displayed in the log editor and on the log panel. |
![]() |
You can clear table, set Mode,
Object or import search-replace pattern using main menu - Grid. |
![]() |
Plain Text RTF HTML Filtered - delete tags from html files As is.. - View html file in build-in browser Search and replace functions is not working in RTF mode !!! |
![]() |
- create index of html-files in current folder. - convert all html files in current folder to plain text files - convert all txt files in current folder to html files (with syntax highlighting for source files) - delete zero size files - replace 0-31 ASCII code chars to printable char. - replace &#xxxx; sequence to national code page chars. |
Note. Creation of Index File
Index File is the file with hyperlinks on all html-files on current folder.
For text of hyperlinks is using contents of <title> tag. Program search
beginning pattern <title> and ending pattern </title> and create hyperlink
from file name and<TITLE> tag.
For example
file name is "Chapter1.html TITLE tag is <TITLE> Chapter 1: Rapid-Q Overview
</TITLE>
Hyperlink is <a href="chapter1.html"> 'Chapter 1: Rapid-Q Overview' </a>
But you can use another text, that determined by search and replacement string table.
In Operations column select Create Index File operation. In Search cell insert any pattern of beginning, in replace cell insert any pattern of ending. If in file there are such text block, then hyperlinks will be formed using this text.
For example
In the file named "Chapter1.html " there are string <H1> 1. Rapid-Q Overview
</H1>
select cell is <H1>, replace cell is </H1>
Hyperlink is <a href="chapter1.html"> Rapid-Q Overview </a>
![]() |
Save copies
- save original files and last changes. (See also BackUp) Confirmations - prompt for search and replace options before start process. Save log - save log file (disabled in current version) Case sensitive - Case sensitives. For Block operations always ON UTF8 - If checked and if row code page is ANSI (Win) will also search and replace using UTF8 code. Use As is.. view mode for visuability UTF8 coded text. Font and colors - Font and colors settings for search and replacement table, table editor, file editor etc. |
![]() |
BackUp managing. All files
from the current folder will be processed. Original files will be stored
in \Original subfolder. Original copy will be created only when you start
process first time. Next copies will be stored in \LastCopy subfolder in
the current folder. For quick access to this folders you can use "View.." menu items. |
![]() |
You can choose limitation
method for non-registered copy of RQ Search and Replace program. 1. File size is limited by 20 kb. Batch process is unlimited. 2. Batch process is limited by 5 files on one click. File size is unlimited. Restart program is needed for new method applied. |
Additional functions
You can convert text files into html (with the syntactic
highlighting for sources files .asm, .bas, .c, .pas)
Keywords are stored in files asm.key, bas.key, c.key, pas.key.
You can add custom keywords in this files.
For building a table of contents it is necessary to choose in the list only files of a HTML-format. Otherwise file of a table of contents can be not generated.
If you have any comments about please direct its to
mira@mail.line1.ru or diakin@narod.ru to Andrew Shelkovenko.