Find and Replace in Gmail

I can do find and replace in one που γράφω στο Gmail; Οι are meant to be read, and therefore the developers did not take care to include the "find and replace" feature in the browsers' code.queues

Websites, however, have evolved and now have not only static content. So if you write long emails or even want to find text in webpages, and you want to fix annoying misspellings, you need to fix them one by one.

You cannot automatically replace a word or phrase on a web page without using pro extensionsof browsing.

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 the three Ctrl + Shift + J keys on a Windows or Cmd + Opt + J on Mac system 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.

.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

Of course, your changes are not saved on the page you are editing when you close the browser tab.

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 bugs in Gmail in bulk, you can copy the e-mail to a notebook, and search and replace. Then paste the processed text back into Gmail. Or you can directly use Chrome 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.).