Special Replacement Operators Overview
Search and Replace has the following special replacement operators:
Operator |
Function |
%1<%0.2lf(E1/2)> |
A special Number Replacement that returns the %1 term number string divided by 2. The string retuned will have 2 decimal places. |
%%srfound%% |
Returns the current search string. |
%%srfound %% - Special |
A special form of the %%srfound%% operator can be used to strip specified characters from the search hit. See %%srfound %% - Special for more information. |
%%srpath%% |
Returns the path of the current file |
%%srfile%% |
Returns the file name |
%%srfiledate%% |
Returns the current date stamp of the file. This is the date prior to a replace made by Search and Replace. |
%%srfiletime%% |
Returns the current time stamp of the file. This is the time prior to a replace made by Search and Replace. |
%%srfilesize%% |
Returns the file size prior to the replace made by Search and Replace. |
%%srdate%% |
Returns the current date of the machine. |
%%srtime%% |
Returns the current time of the machine. |
%%srprepend%% |
See Special Script Prepend-Append Operators for more information. |
%%srformat%%=xx |
A special binary search operator, %%srformat%%=xx, is used to Reformat Files at the specified column, xx. |
%%envvar=winbootdir%% |
An example of the Environment Variable function. This replace would return the machine environment variable, Winbootdir. This type of string can also be used in the search string. |
%%today%% |
This is not a replacement operator. %%today%% is used in manually created scripts. |
Notes:
The above are replace operators, not search operators.
These operators may be used in ordinary search & replace operations, Regular Expressions, Regular Expression Counters, Scripts, and Binary Mode operations.
It is not necessary to activate Regular Expression mode to use the above operators. They can be used in the Binary Mode replace string dialog and the main dialog replace field without enabling Regular Expression mode. For example, the first sample below does not require regular expression mode.
The Environment Variables operators may be used with regular expressions.
Special Replacement Operator Examples | |
Ordinary Search/Replace |
|
File Searched: |
D:\Example\Test.txt |
Complex Search/Replace |
|
Files Searched: |
home.htm; index.html |
Note for Advanced Users:
%%srpath%% and %%srfile%% can be used in Command Line operations. However, some extra steps will be necessary to deal with the "%%" characters.
For example, on a Win95 machine, the following SET commands:
SET T=%%%
SET P=srpath
SET F=srfile
and the command line:
SR32 /I /Pexample.txt /S"Page No." /R"%t%%p%%t%%t%%f%%t%, Page No."
replaces all instances of the string Page No. in the file example.txt (which is in the path d:\example) to d:\example\example.txt, Page No.
Consult your operating system manual for further information on how to pass the literal %% characters to the command line.