Google Docs finally replaced the partially functional "find & replace" dialog inherited from Writely with an inline bar that actually works. Just select "Find & replace" from the "Edit" menu or type Ctrl+F to make the bar visible. To find the next match, click on "Find next" or type Ctrl+G.
The option can be used to find a text in your document and to replace it with a different text. If you click on the small arrow next to the first input box, you'll be able to set some restrictions: case matching, finding only whole words or using JavaScript-style regular expressions. For example, to remove all the email addresses from a document, use the following regular expression for email addresses:
[a-zA-Z0-9]+[a-zA-Z0-9._%-]*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}
If you know some other potentially useful regular expressions in a word processor, share them in the comments.
{ via Google Docs Blog }
March 25, 2009
Subscribe to:
Post Comments (Atom)
jane@doe.museum wouldn't be removed. That regexp is incorrect. Change [a-zA-Z]{2,4} to [a-zA-Z]+
ReplyDeleteThat final {2,4} should be {2,6} if you want that expression to work for more email addresses like .museum . Really, if you want it to work for future TLDs that may not even exist yet, you should go with {2,} .
ReplyDeleteThanks, I updated the expression.
ReplyDeleteThere are still plenty of problems with your regular expression
ReplyDeleteTry it with the very common
name+filter@gmail.com
Email addresses can use any characters before the @ sign, not just alphanumerics. (See RFC 2822 for details)
this well known regexp implements RFC 2822
ReplyDeletehttp://code.iamcal.com/php/rfc822/full_regexp.txt
but i always use this one
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
and the second one will find text only outside html tags
ReplyDelete~(?!<.*)(?<!\w)(words|to|find)(?!\w|[^<>]*>)~i
Does somebody know how to find in Google docs all carriage return and replace them with nothing. Would be very useful. That's one of the few case I have to launch Winword (^p)again.
ReplyDelete@Guy DERIDET: You could try viewing the HTML source and removing the
ReplyDeletetags.
Please don't regexp match email addresses, it just can't be done in a sane way!
ReplyDeleteIt's strange that there isn't a command for testing email addresses in PHP/ASP.net. You need to send the email to be sure if it works or not, if there is a command to do a partial send then that could be used. E.g. Just connect to the mail server and say that you have "Rcpt to:<emai>" and check if it is accepted.
I'm used to hitting the return key multiple times for successive searches, but this will delete the string that's found in Google Docs... argh.
ReplyDelete> I'm used to hitting the return key multiple times for successive searches, but this will delete the string that's found in Google Docs... argh.
ReplyDeleteSECOND THIS! Very annoying. Another annoyance is that if I want to search across a few tabs, I have to enter my search string again. Using my browser's find, I could enter it once, then just *switch tab* *ctrl-g*, which is much more efficient.
I think this is great for those who use regex's, but for the rest of us it's just annoying. I think there should be an option that we can set so the new find bar can only be brought up through the menus.
Philipp, I found out something wonderful today that I just had to share. Instead of using ctrl-f, hit 'f' twice to get to your browser's search :)
ReplyDeleteThe new find key is ctrl-f-f ;)
> Philipp, I found out something wonderful today that I just had to share. Instead of using ctrl-f, hit 'f' twice to get to your browser's search :)
ReplyDeleteI'm very jealous..this doesn't work on mac os x.
Any way to disable this custom find bar????? VERY ANNOYING!
ReplyDeleteYou can disable it by installing firebug, or using developer tools on chrome.
ReplyDeleteOpen the javascript console, and type "WritelyVars.enable_find_bar=false".
You'll need to do this every time.
You should try zoho, it generally works better, and no stupid find bar.
y would you guys put a character limit on this function...totally useless now ;( back to ms word...
ReplyDeleteI wish there was the ability to "find and replace" by "color"
ReplyDeletewe use Google docs with coloring sections and it would be very helpful to be able to find and replace by color as an option in conjunction with the traditional text options such as whole or entire word etc.
What about wildcards? Is there any way to find and replace using wildcards?
ReplyDeleteUmmm... I couldn't know less about computers, is there anyway that you could break it in to terms that a history and english person would understand...
ReplyDelete