title: mailto: open google chrome in Ubuntu with notify msg
body: <p>I'm writing a small script to open mailto links from webpages in google chrome small app window:</p>
  
  <p>so far I have this:</p>
  
  <pre><code>#!/bin/sh
  
  notify-send "Opening Gmail" "`echo $1`" -i /usr/local/share/icons/hicolor/48x48/apps/google-chrome.png -t 5000
  google-chrome -app="https://mail.google.com/mail/?extsrc=mailto&amp;url=`echo $1`"
  </code></pre>
  
  <p>which works nice - however I'd like to add the email recipient to the notification - something like this - but I need a regex to get the email from the mailto link - which might contain subjects and such..</p>
  
  <pre><code>#!/bin/sh
  
  $str = preg_replace('#&lt;a.+?href="mailto:(.*?)".+?&lt;/a&gt;#', "$1", $str);
  notify-send "Opening Gmail" "`echo $str`" -i /usr/local/share/icons/hicolor/48x48/apps/google-chrome.png -t 5000
  google-chrome -app="https://mail.google.com/mail/?extsrc=mailto&amp;url=`echo $1`"
  </code></pre>
  
  <p>this does not work..</p>
  
  <p>any ideas?</p>
  
  <p>UPDATE: here's the working code:</p>
  
  <pre><code>#!/bin/sh
  
  str=$(echo $1|sed 's/.*mailto:\([^?]*\)?.*/\1/')
  notify-send "Opening Gmail" "to: `echo $str`" -i /usr/local/share/icons/hicolor/48x48/apps/google-chrome.png -t 5000
  google-chrome -app="https://mail.google.com/mail/?extsrc=mailto&amp;url=`echo $1`"
  </code></pre>