Find and Replace Characters in Google Docs

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
January 23, 2009

The “Find and Replace” function in Google Docs works just as well as in Microsoft Word. If you wish to replace the name “Peter”, appearing frequently in any document with “Tom”, you can do it quickly with the “Find and Replace” command. You must be an expert in using “Find and Replace”, if you need to modify general replacement of words. But looking for complex characters won’t be easy as searching for plain texts.

find and replace google docs Google docs provides an option for Searching for characters using Regular Expressions. “Regular Expressions” commonly called “Regex” are a set key combinations that let people have a wide range of control over what they are looking for. It can be called a mini-programming language used for identifying certain strings.

To look for words using the Regular Expressions in Google Docs, first open up the “Find and Replace” box by pressing Ctrl+H. There you’ll see a checkbox called “Regular Expressions”. Check the box. Actually Google Docs’ Find and Replace function is not as dedicated as the one in Windows Applications because once you use this command all the expressions matching the keyword throughout the document will be replaced. And once you use “Find and Replace”, you cannot undo it. So, saving the document before making a change would be wise. There will be no change in the layout of the document.

Lets start with some of the interesting Regex syntaxes for making things easier.

Replacing confusing email Addresses with the real ones: To protect from spammers, people usually “at” replacing “@” in their email addresses. So how would you go looking for such email addresses? Using short Regex syntax can make it easier for you. In your Google Docs file, enable “Regular Expressions” in the Find and Replace command and use the following:

Find: ([A-Za-z0-9_\+\.]+) at (\w+) dot (\w+)

Replace with: $1@$2.$3

Actually this piece of code looks for all the alphabetical and numeric characters that are permitted before “@” sign in an email address. Then it looks for the word “at” with the spaces before and after it and the alphanumeric characters again for “dot com” or something like that. The “$” sign used in “Replace with” is for replacing things within the subsequent parenthesis. Like, $2 will replace “at” with “@”. If an email address “abc at hotmail dot com” appears somewhere in your document, it will be replaced by “” using the above code.

Changing date formats: You can change the date formats using Regex. The following will Replace all dates appearing in the format Monthname-Date-Year with Day-Month-Year.

Find: ((Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec).*) (\d\d?), (\d{4})

Replace with: $3 $1, $4

Here the first set of parentheses will look for all the month names. The pipe sign “|” is used for matching Jan, Feb, Mar etc. The .* will match the abbreviation or the full name like it can figure out “Jan” and “January” both.

Finding all URLs in a page: Sometimes URLs in a page appear without http:// before them. Using the following code, you can add “http://” before all links without http:// appearing in your document. This will make it easy for you to look for the URLs.

Find: (([-\w]+\.)+[-\w]+)

Replace with: http://$1

So, using Regex you can do a lot of interesting things with “Find and Replace” command in Google Docs.

There will be no change in the layout of the document.

You may also like...