Find and Replace in Gmail

Can I find and replace a message I write in Gmail? The web pages are for reading purposes and therefore the developers did not make sure to include the "find and replace" feature in the browser code.queues

Websites, however, have evolved and are no longer just about static content. So if you write long emails or even want to find text in web pages, and wish to correct annoying typos mistakes, you should correct them one by one.

You can not automatically replace a word or phrase on a webpage without using browser extensions.

The following publication will show you a simple technique to help you search for and replace text on web pages using the built-in Chrome Developer Tool.

Open a page you want to edit.

While on the web page, press together the three keys Ctrl+Shift+J in a system with or Cmd+Opt+J on a Mac to open the Chrome Developer Tools console window.

Immediately after, give the following command to replace all appearances of the word iguru with iguru.gr.

document.body.innerHTML = document.body.innerHTML.replace (/ iguru / g, "iguru.gr")

You can use regular expressions for more complex substitutions. For example, if you want to replace all common misspellings, you could use some of these:

document.body.innerHTML.replace (/ (iguru | igurunews) / g, "iGuRu News") document.body.innerHTML.replace (/ ig [\ w] + ews / g, "iGuRu News")

The same technique can be used to format a page. For example, the next command will bold the word iguru on a page.

document.body.innerHTML.replace (/ iguru / g, "iguruΒ>")

Search and replace text in Gmail

Your changes are of course not saved to the page you are editing when you close it of the browser.

Can you wonder why someone will search and replace on a website?

To explain the practicality of the above tweak, we'll give an example with Gmail.

You may have written a big email, but you find out before it is written that it contains misspellings.

To fix errors in bulk in Gmail, you can copy the email to , and perform search and replace. You will then need to paste the edited text back into Gmail. Or you can directly use Chrome's Dev tools.

In our previous example, we searched and replaced in document.body, which is addressed to websites. Let's see how it works in Gmail.

The first step is to find the word in the message you want to search & replace. Select the text you want in the Gmail window, right-click and select Item Review. It will give you the identity of the DIV that contains the editable text area. In our case it is ": 1cv" for Gmail.

code gmail

Now all you need to do is run the following replacement command in the console window to replace the word iguru with the word igurunews everywhere.

document.getElementById (': 1cv'). innerHTML = document.getElementById (': 1cv') innerHTML.replace (/ iguru / g, "igurunews");

iGuRu.gr The Best Technology Site in Greecefgns

every publication, directly to your inbox

Join the 2.087 registrants.

Written by Dimitris

Dimitris hates on Mondays .....

Leave a reply

Your email address is not published. Required fields are mentioned with *

Your message will not be published if:
1. Contains insulting, defamatory, racist, offensive or inappropriate comments.
2. Causes harm to minors.
3. It interferes with the privacy and individual and social rights of other users.
4. Advertises products or services or websites.
5. Contains personal information (address, phone, etc.).