Simple replacements
Sometimes you need to extract a part of the matching text and insert it into your replacement text. A typical example is displaying external links in a different color:
Search for | Replace to | Explanation |
<a href="(http://[^"]+)"> |
<a href="\1" class="external-link"> |
Highlighting external links |
The parentheses “capture” the subexpression, and \1 inserts it into your replacement text. \1
is the text inside the first parenthesis, \2
is the second one, and so on. \0
means the whole matching text. More examples:
Search for | Replace to | Explanation |
http://[a-zA-Z0-9./_&=%?~#-]+ |
<a href="\0">\0</a> |
Make plain-text links clickable, i.e. put them into <A> tags |
(\d\d?)/(\d\d?)/(\d\d\d\d) |
\2.\1.\3 |
Convert the US date format (4/25/2010) to the German format (25.4.2010) |
\<(\w+) \1\> |
\1 |
Remove repeating words (the the will be changed to a single the ) |
If you don't want parentheses to capture the subexpression, use a non-capturing group.
To insert a literal backslash character in your replacement text, repeat it twice: \\
instead of \
.
The following escape sequences are also supported:
\t
inserts a tab character into the replacement;\r
inserts a carriage return character;\n
inserts a line feed character.
You can also use the complex replacement syntax that allows you to transform the match or the subexpressions.
This is a page from Aba Search and Replace help file.
- Welcome to Aba
- Getting started
- How-to guides
- Selecting the files to search in
- Inserting some text at the beginning of each file
- Replacing multiple lines of text
- Searching in Unicode files
- Replacing in binary files
- Performing operations with the found files
- Undoing a replacement
- Saving search parameters for further use
- Removing private data
- Adding or removing Aba from Explorer context menu
- Integrating Aba with Total Commander
- Integrating Aba with Free Commander
- Integrating Aba with Directory Opus
- Regular Expressions
- Replacement syntax
- User interface
- Command line
- Troubleshooting
- Glossary
- Version history
- Credits