Replacing Text
See Also: Finding Text

These examples all use UNIX extended regular expression syntax.

1. Find any alphabetic word starting with an upper case letter:

[A-Z][a-z]+

and replace with the same word all in upper case:

\U&

2. Find a C language variable name starting with a lower case letter:

\<[a-z][ a-zA-Z0-9]*

and make the first letter upper case:

\u&

3. Find two numeric strings separated by one or more spaces:

\([0-9]+\) +\([0-9]+\)

and swap them around, using a tab to separate them:

\2\t\1

4. Find "paste":

paste

and replace with the contents of the clipboard:

\p

5. To change:

X100000  to  X100.000
Y100123 Y100.123
Z600 Z.600
Find:\([XYZ]\)\([0-9]*\)\([0-9][0-9][0-9]\)
Replace:\1\2.\3