Free search and replace tool downloads
Main Products
HandyFile Find and Replace
 
Web Design Utilities
 
Buy On-line
 
Latest releases
Text Workbench:
5.0 SP8 New!
09 January 2008
Text Aid Kit:
3.2 SR7
2 March 2007
Office Edition:
3.4 SR4
3 March 2007
Related links
 Printable guides 
Office Edition & TAK
Text Workbench

Downloads
 

HandyFile Find and Replace

Regular Expression Examples

Below are given some examples of using regular expressions in various situations.

Compress whitespace (spaces, tabs, line breaks).

Find pattern
\s+
Replace pattern
  (single space; or \x20 for better replace text readability)

Find any HTML colour constant.

Find pattern
\#{[0-9A-Fa-f]}+

Replace all HTML colour constants with the new one (#AFEEEE).

Find pattern
\#{[0-9A-Fa-f]}+
Replace pattern
#AFEEEE

Replace all occurrences of full stop before the lowercase letter with comma, truncating separating spaces to only one (useful for scanned documents).

Find pattern
{\.\s#}(\L[a-z])
Replace pattern
\, \1

Strip HTML tags.

Find pattern
{\<}{\/?}{.#}{\>}
Replace pattern
empty

Replace <P> tags with <DIV> tags, preserving tag attributes.

Find pattern
\<P\s(.#)\>(.#)\<\/P\>
Replace pattern
<DIV \1>\2</DIV>

Colorize HTML tags for use inside HTML page: symbols with blue, tag with red, convert < and > to entities.

Find pattern
\<({\/}?)(.#)\>
Replace pattern
<span style="color:blue">&lt;\1</span>
<span style="color:red">\2</span><span style="color:blue">&gt;</span>

Insert comment with the file name at the beginning of all .cpp files.

Find pattern
^(.)
Note the use of the match-and-store-first-symbol operators: ^ acts as a positioner only.
Replace pattern
/**************************************\r\n
This file name: \f
\r\n**************************************/\r\n\r\n\r\n\1
 
© 2001-2008 SilverAge Software. All rights reserved.