Searching GMail with Regex

Interesting discussion in IT Professionals community I saw regarding needing to be able to search GMail for some IP addresses.
I’ve tinkered around with a few things and found a pretty easy way to do the regex searches.

Step 1: Setup Google Doc’s Sheet

Source: http://www.labnol.org/internet/advanced-gmail-search/21623/
Follow these directions to the end of #2 below:

  1. Click here to make a copy of the Gmail RegEx sheet into your Google Docs account.
  2. Wait for 10–15 seconds and a new Gmail RegEx menu will appear in your new Google sheet. Choose Initialize from the menu and grant the necessary permissions as requested by the program.
  3. The program will search your entire mailbox by default but if you would like to limit the search to any particular lable (say Inbox or Spam), just put that label name in cell F3.
  4. Now enter any regular expression in the cell F4 and choose “Search Mailbox” from the Gmail RegEx menu to begin searching.

Step 2: Modify Script

We need to modify the script since the subject is what contains the IP address that have been emailed.
Click on Tools > Script editor…
1
When this opens, modify line #32:
Originally, it says:

var msg = messages[m].getBody();

Change it to:

var msg = messages[m].getSubject();

2
Save your script…
3

Search!

Back on the spreadsheet, fill in the search field with the following regex.

d{1,3}.d{1,3}.d{1,3}.d{1,3}

Note: This will match 0.0.0.0–999.999.999.999 — but who cares… we’re not being that strict are we? I’ll leave the exercise to you to filter for proper IPv4 address or even IPv6 hah.
So with the regex entered in, go up to GMail Regex > Search Mailbox
4

Results, Prosper

Here’s an example?—?I sent myself some test messages with some IP addresses in the subject.
5

Wordle for My Site

This is my Wordle for my website. You can create a wordle of your own by visiting http://www.wordle.net/create.
Wordle is a toy for generating “word clouds” from text that you provide. The clouds give greater prominence to words that appear more frequently in the source text. You can tweak your clouds with different fonts, layouts, and color schemes. The images you create with Wordle are yours to use however you like. You can print them out, or save them to the Wordle gallery to share with your friends.
2014-06-11_123918

Conditional Selectors in CSS Rock

I have been working on a web project that involves some HTML data that I can’t change statically, with the exception of some CSS modification abilities. Since I can’t make any adjustments to this software’s output of HTML data, or Javascript, I have been able to figure out cool little tricks to change things on the resulting HTML page by using CSS.
Take the following for example. There is a bar that is shown at the top of the page. This is styled with a DIV tag with no ID or NAME attribute. So it was initially hard for me to figure out how to catch this item and remove it. I figured out a way using a conditional selector in CSS.
Original line in HTML

<div style=background:url(/images/top-bar-bg.png) center repeat-x;height:32px;text-align:center;>
 <span style=background:url(/images/top-bar-icon.png) center left no-repeat;padding-left:30px;font-family:Arial, Helvetica, sans-serif;font-size:13px;font-weight:normal;color:#4a4a4a;display:inline-block;border:none;margin-top:4px;></span>
 </div>

How I hid this element using CSS Selector

div[style ^='background:url(/images/top-bar-bg.png)'] { display:none; visibility:hidden; }

This worked for me because I know that this is the only DIV element with this style attribute. Otherwise I think it would hide all the elements that match this.
An attribute selector will match elements on the basis of either the presence of an attribute, or the exact or partial match of an attribute value. Attribute selectors were introduced in CSS2, and CSS3 added a few more.
Attribute selectors are delimited by square brackets; the simplest form of an attribute selector consists of an attribute name surrounded by square brackets.
^= – starts with
$= – ends with
~= – matches any space separated words (foo bar baz)
|= – matches any hyphenated words (foo-bar, bar-baz)
I’m not a web developer, designer or geek. Just thought I’d share some sweet knowledge I just figured out.