<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Regular Expression Help</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Fri, 19 Mar 2010 00:27:46 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DRIVE</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-5031</link>
		<dc:creator>DRIVE</dc:creator>
		<pubDate>Wed, 16 Feb 2005 20:46:11 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-5031</guid>
		<description>&lt;code&gt;
&lt;?php
$hostname = ($_SERVER[&#039;SERVER_NAME&#039;]);
preg_match(&quot;/[^\.\/]+\.[^\.\/]+$/&quot;, $hostname, $matches);
echo &quot;domain name is: {$matches[0]}\n&quot;;
?&gt;
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p><code><br />
&lt;?php<br />
$hostname = ($_SERVER['SERVER_NAME']);<br />
preg_match("/[^\.\/]+\.[^\.\/]+$/", $hostname, $matches);<br />
echo "domain name is: {$matches[0]}\n";<br />
?&gt;<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel Radic</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1869</link>
		<dc:creator>Gabriel Radic</dc:creator>
		<pubDate>Mon, 15 Nov 2004 17:01:38 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1869</guid>
		<description>Eric, you&#039;re using a Mac, right? Then love your Keychain.</description>
		<content:encoded><![CDATA[<p>Eric, you&#8217;re using a Mac, right? Then love your Keychain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jlcooke</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1681</link>
		<dc:creator>jlcooke</dc:creator>
		<pubDate>Fri, 05 Nov 2004 14:16:12 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1681</guid>
		<description>A few things:
 - If this &quot;master password&quot; to &quot;site password&quot; thing is going to work, you need more than just a master password hashed with a website domain name.
   + sitepswd = hash(secret + pswd + domain), where secret is randomly generated and stored in a cookie.
     This is no good for &quot;roaming&quot; users who don&#039;t have a dedicated computer, but, meh.
 - Your site password needs to use more then just hex, try the full [0-9][a-z][A-z](~!@#$%^&amp;*()_+-=) you&#039;ll make the passwords harder to guess that way.

Here&#039;s a few tools that might be handy:
Generate a password using mouse movments, timing and SHA-256:
  http://www.certainkey.com/demos/mkpasswd
Check password strength:
  http://www.certainkey.com/demos/password</description>
		<content:encoded><![CDATA[<p>A few things:<br />
 &#8211; If this &#8220;master password&#8221; to &#8220;site password&#8221; thing is going to work, you need more than just a master password hashed with a website domain name.<br />
   + sitepswd = hash(secret + pswd + domain), where secret is randomly generated and stored in a cookie.<br />
     This is no good for &#8220;roaming&#8221; users who don&#8217;t have a dedicated computer, but, meh.<br />
 &#8211; Your site password needs to use more then just hex, try the full [0-9][a-z][A-z](~!@#$%^&#038;*()_+-=) you&#8217;ll make the passwords harder to guess that way.</p>
<p>Here&#8217;s a few tools that might be handy:<br />
Generate a password using mouse movments, timing and SHA-256:<br />
  <a href="http://www.certainkey.com/demos/mkpasswd" rel="nofollow">http://www.certainkey.com/demos/mkpasswd</a><br />
Check password strength:<br />
  <a href="http://www.certainkey.com/demos/password" rel="nofollow">http://www.certainkey.com/demos/password</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martijn Ras</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1598</link>
		<dc:creator>Martijn Ras</dc:creator>
		<pubDate>Wed, 03 Nov 2004 16:24:20 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1598</guid>
		<description>Heya Nathan,

Thanks for noticing my comment &lt;a href=&quot;http://www.meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1463&quot;&gt;# 32.&lt;/a&gt;

Mazzel,

Martijn.</description>
		<content:encoded><![CDATA[<p>Heya Nathan,</p>
<p>Thanks for noticing my comment <a href="http://www.meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1463"># 32.</a></p>
<p>Mazzel,</p>
<p>Martijn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Chandler</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1552</link>
		<dc:creator>Peter Chandler</dc:creator>
		<pubDate>Mon, 01 Nov 2004 03:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1552</guid>
		<description>What&#039;s the point? How would the hash be any more secure than just the master password?

If you&#039;re going to do this, you&#039;d be better off using a more obscure hash than MD5.</description>
		<content:encoded><![CDATA[<p>What&#8217;s the point? How would the hash be any more secure than just the master password?</p>
<p>If you&#8217;re going to do this, you&#8217;d be better off using a more obscure hash than MD5.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Herald</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1539</link>
		<dc:creator>Nathan Herald</dc:creator>
		<pubDate>Sun, 31 Oct 2004 08:54:44 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1539</guid>
		<description>I have made a favelet some of you might want to check out. It does not read the website automagically, you enter it manually. But it works. 

http://www.myobie.com/password/

Hope this helps someone, I am thinking about using it for a while.</description>
		<content:encoded><![CDATA[<p>I have made a favelet some of you might want to check out. It does not read the website automagically, you enter it manually. But it works. </p>
<p><a href="http://www.myobie.com/password/" rel="nofollow">http://www.myobie.com/password/</a></p>
<p>Hope this helps someone, I am thinking about using it for a while.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Herald</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1517</link>
		<dc:creator>Nathan Herald</dc:creator>
		<pubDate>Sat, 30 Oct 2004 22:18:21 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1517</guid>
		<description>This would work great:
&lt;blockquote cite=&quot;dude above&quot;&gt;
&lt;code&gt;
[^.]*\.\([^:/]*\).*
&lt;/code&gt;
&lt;/blockquote&gt;

When can we see this bookmarklet in action Eric?
I would like to see it put to the test...</description>
		<content:encoded><![CDATA[<p>This would work great:</p>
<blockquote cite="dude above"><p>
<code><br />
[^.]*\.\([^:/]*\).*<br />
</code>
</p></blockquote>
<p>When can we see this bookmarklet in action Eric?<br />
I would like to see it put to the test&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ondrej Valek</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1491</link>
		<dc:creator>Ondrej Valek</dc:creator>
		<pubDate>Fri, 29 Oct 2004 01:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1491</guid>
		<description>Is that worth trying? From my point of view and everyday&#039;s experience, every site requires different type of password. One asks for digits-only, another for 5-to-10 characters alphabet-only and so on. It&#039;s impossible to create them automagically. I prefer having one stupid password which I use everywhere with just minor predictable changes, which i never use for &#039;mission critical&#039; sites. And I never use those web passwords for digital signatures or real-life needs, like bank accounts or whatever.</description>
		<content:encoded><![CDATA[<p>Is that worth trying? From my point of view and everyday&#8217;s experience, every site requires different type of password. One asks for digits-only, another for 5-to-10 characters alphabet-only and so on. It&#8217;s impossible to create them automagically. I prefer having one stupid password which I use everywhere with just minor predictable changes, which i never use for &#8216;mission critical&#8217; sites. And I never use those web passwords for digital signatures or real-life needs, like bank accounts or whatever.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jgraham</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1467</link>
		<dc:creator>jgraham</dc:creator>
		<pubDate>Thu, 28 Oct 2004 15:38:13 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1467</guid>
		<description>From the point of view of actually using this, the important comment is  Jesse&#039;s comment 22 - if you use this utility as a bookmarklet, any site can easilly steal your master password and thus your login to &lt;em&gt;all&lt;/em&gt; other sites that you use. That seems like an awful lot of risk. (there are other, practical, issues, like sites that require the same login but are at different domains, but they&#039;re somewhat irrelevant in the face of the huge gaping secuirty hole that this bookmarklet opens up). The version with a hardcoded master password variable is a little better (you need to be sure that you trust people with physical access to your machine and that your machine in general is secure).</description>
		<content:encoded><![CDATA[<p>From the point of view of actually using this, the important comment is  Jesse&#8217;s comment 22 &#8211; if you use this utility as a bookmarklet, any site can easilly steal your master password and thus your login to <em>all</em> other sites that you use. That seems like an awful lot of risk. (there are other, practical, issues, like sites that require the same login but are at different domains, but they&#8217;re somewhat irrelevant in the face of the huge gaping secuirty hole that this bookmarklet opens up). The version with a hardcoded master password variable is a little better (you need to be sure that you trust people with physical access to your machine and that your machine in general is secure).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aristotle</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1466</link>
		<dc:creator>Aristotle</dc:creator>
		<pubDate>Thu, 28 Oct 2004 11:52:09 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1466</guid>
		<description>Oh, and btw: how about not using the URL, but simply letting you pick a local password yourself? So for Amazon, you&#039;d enter your master password and &quot;amazon&quot; to get a unique site password. Sure you&#039;ll have to remember two things, but the local password can be reasonably trivial and even be written down without a real problem.

Having a bit of code that &lt;em&gt;proposes&lt;/em&gt; such a site password by looking at the URL would be beneficial, then. You can still override it if it guesses badly, and twiddle the heuristics if there is a pattern to bad guesses, without ever risking loss of access to any place.</description>
		<content:encoded><![CDATA[<p>Oh, and btw: how about not using the URL, but simply letting you pick a local password yourself? So for Amazon, you&#8217;d enter your master password and &#8220;amazon&#8221; to get a unique site password. Sure you&#8217;ll have to remember two things, but the local password can be reasonably trivial and even be written down without a real problem.</p>
<p>Having a bit of code that <em>proposes</em> such a site password by looking at the URL would be beneficial, then. You can still override it if it guesses badly, and twiddle the heuristics if there is a pattern to bad guesses, without ever risking loss of access to any place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aristotle</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1465</link>
		<dc:creator>Aristotle</dc:creator>
		<pubDate>Thu, 28 Oct 2004 11:39:09 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1465</guid>
		<description>&lt;code&gt;$ perl -MRegexp::Common=URI -le&#039;print $RE{URI}{HTTP}{-scheme =&gt; &quot;https?&quot;}{-keep}&#039;
&lt;strong&gt;((https?)://((?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]&#124;[a-zA-Z])[.]?)&#124;(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::((?:[0-9]*)))?(/(((?:(?:(?:(?:[a-zA-Z0-9\-_.!~*&#039;():@&amp;=+$,]+&#124;(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*&#039;():@&amp;=+$,]+&#124;(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\-_.!~*&#039;():@&amp;=+$,]+&#124;(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*&#039;():@&amp;=+$,]+&#124;(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?]((?:(?:[;/?:@&amp;=+$,a-zA-Z0-9\-_.!~*&#039;()]+&#124;(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)&lt;/strong&gt;&lt;/code&gt;

The third capture group will contain the hostname. The pattern fully respects every aspect of the HTTP URI RFC; I don&#039;t know if the JavaScript pattern dialect supports all the features found in Perl&#039;s, though.

Unfortunately, due to aforementioned problems with domain structures like in &lt;code&gt;.co.uk&lt;/code&gt; and the like, you can&#039;t really tell how much you can chop off the front of the FQDN&#8230;</description>
		<content:encoded><![CDATA[<p><code>$ perl -MRegexp::Common=URI -le'print $RE{URI}{HTTP}{-scheme => "https?"}{-keep}'<br />
<strong>((https?)://((?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.])*(?:[a-zA-Z][-a-zA-Z0-9]*[a-zA-Z0-9]|[a-zA-Z])[.]?)|(?:[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+)))(?::((?:[0-9]*)))?(/(((?:(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&#038;=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&#038;=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*)(?:/(?:(?:(?:[a-zA-Z0-9\-_.!~*'():@&#038;=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)(?:;(?:(?:[a-zA-Z0-9\-_.!~*'():@&#038;=+$,]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*))*))*))(?:[?]((?:(?:[;/?:@&#038;=+$,a-zA-Z0-9\-_.!~*'()]+|(?:%[a-fA-F0-9][a-fA-F0-9]))*)))?))?)</strong></code></p>
<p>The third capture group will contain the hostname. The pattern fully respects every aspect of the HTTP URI RFC; I don&#8217;t know if the JavaScript pattern dialect supports all the features found in Perl&#8217;s, though.</p>
<p>Unfortunately, due to aforementioned problems with domain structures like in <code>.co.uk</code> and the like, you can&#8217;t really tell how much you can chop off the front of the FQDN&hellip;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Ward</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1464</link>
		<dc:creator>Michael Ward</dc:creator>
		<pubDate>Thu, 28 Oct 2004 09:48:11 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1464</guid>
		<description>Mozilla Firefox RC1 has a master passowrd setting for the automatic inputting of usernames/passwords for web sites.

It works by, once per browser session, prompting for the master password  when a website with saved login details is accessed.

Works very well IMHO.</description>
		<content:encoded><![CDATA[<p>Mozilla Firefox RC1 has a master passowrd setting for the automatic inputting of usernames/passwords for web sites.</p>
<p>It works by, once per browser session, prompting for the master password  when a website with saved login details is accessed.</p>
<p>Works very well IMHO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martijn Ras</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1463</link>
		<dc:creator>Martijn Ras</dc:creator>
		<pubDate>Thu, 28 Oct 2004 08:54:07 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1463</guid>
		<description>Heya Eric,

It&#039;s really not that hard, here&#039;s my regular expression:

[^.]*\.\([^:/]*\).*


You&#039;re not interested in everything up to the first dot in the hostname &quot;[^.]*\.&quot;, what comes next is of interest up to either the start of the port (:) or the path (/), anything after that is of no interest either.

Here&#039;s two examples:
echo &quot;http://www.domain.tld/blah/foo/wow.xyz&quot; &#124; sed &#039;s/[^.]*\.\([^:/]*\).*/\1/&#039; =&gt; domain.tld

echo &quot;http://www.very.long.domain.co.uk/blah/foo/wow.xyz&quot; &#124; sed &#039;s/[^.]*\.\([^:/]*\).*/\1/&#039; =&gt; very.long.domain.co.uk

Mazzel,

Martijn</description>
		<content:encoded><![CDATA[<p>Heya Eric,</p>
<p>It&#8217;s really not that hard, here&#8217;s my regular expression:</p>
<p>[^.]*\.\([^:/]*\).*</p>
<p>You&#8217;re not interested in everything up to the first dot in the hostname &#8220;[^.]*\.&#8221;, what comes next is of interest up to either the start of the port (:) or the path (/), anything after that is of no interest either.</p>
<p>Here&#8217;s two examples:<br />
echo &#8220;http://www.domain.tld/blah/foo/wow.xyz&#8221; | sed &#8217;s/[^.]*\.\([^:/]*\).*/\1/&#8217; => domain.tld</p>
<p>echo &#8220;http://www.very.long.domain.co.uk/blah/foo/wow.xyz&#8221; | sed &#8217;s/[^.]*\.\([^:/]*\).*/\1/&#8217; => very.long.domain.co.uk</p>
<p>Mazzel,</p>
<p>Martijn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Cutter</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1462</link>
		<dc:creator>Thomas Cutter</dc:creator>
		<pubDate>Thu, 28 Oct 2004 05:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1462</guid>
		<description>I could really use some help with regular expressions if somebody out there could email me that would be great. I have a project for work that I need to get done asap and I am pretty clueless when it comes to regular expressions.</description>
		<content:encoded><![CDATA[<p>I could really use some help with regular expressions if somebody out there could email me that would be great. I have a project for work that I need to get done asap and I am pretty clueless when it comes to regular expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Angus Turnbull</title>
		<link>http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1461</link>
		<dc:creator>Angus Turnbull</dc:creator>
		<pubDate>Thu, 28 Oct 2004 04:01:48 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comment-1461</guid>
		<description>Enlighten thyself, grasshopper :). The simplest and best coverage of JavaScript regular expressions I&#039;ve found is this &lt;a href=&quot;http://www.evolt.org/article/rating/20/22700/index.html&quot;&gt;Evolt article&lt;/a&gt;.

Having said that, different countries are REALLY going to be the major problem here. Some countries, like NZ, Australia and the UK, allow second level domain names:

foo.co.nz
bar.co.nz

are completely different sites, whereas in some other countries with first-level domains:

foo.abc.ru
bar.abc.ru

are both subdomains of the main abc.ru site, a fully qualified domain in its own right (unlike co.nz).

So really, you&#039;d need a database in the bookmarklet of all 2 and 3 letter country codes. Otherwise, the script won&#039;t be able to tell which domains san be trimmed down, and which can&#039;t. Alternatively, just list a common bunch of second-level subdomains like (co&#124;com&#124;org&#124;net&#124;gen&#124;mil) and don&#039;t sweat the occasional shared password...</description>
		<content:encoded><![CDATA[<p>Enlighten thyself, grasshopper :). The simplest and best coverage of JavaScript regular expressions I&#8217;ve found is this <a href="http://www.evolt.org/article/rating/20/22700/index.html">Evolt article</a>.</p>
<p>Having said that, different countries are REALLY going to be the major problem here. Some countries, like NZ, Australia and the UK, allow second level domain names:</p>
<p>foo.co.nz<br />
bar.co.nz</p>
<p>are completely different sites, whereas in some other countries with first-level domains:</p>
<p>foo.abc.ru<br />
bar.abc.ru</p>
<p>are both subdomains of the main abc.ru site, a fully qualified domain in its own right (unlike co.nz).</p>
<p>So really, you&#8217;d need a database in the bookmarklet of all 2 and 3 letter country codes. Otherwise, the script won&#8217;t be able to tell which domains san be trimmed down, and which can&#8217;t. Alternatively, just list a common bunch of second-level subdomains like (co|com|org|net|gen|mil) and don&#8217;t sweat the occasional shared password&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head profile="http://gmpg.org/xfn/1">
<title>meyerweb.com</title>
<link rel="openid.server" href="http://www.myopenid.com/server">
<link rel="openid.delegate" href="http://emeyer.myopenid.com/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="shortcut icon" href="/favicon.ico"><link rel="home" href="http://meyerweb.com/" title="Home" ><link rel="stylesheet" href="http://meyerweb.com/ui/meyerweb.css" type="text/css" media="screen, projection"><link rel="stylesheet" href="http://meyerweb.com/ui/theme.css" type="text/css" media="screen, projection" id="themeLink"><link rel="stylesheet" href="http://meyerweb.com/ui/print.css" type="text/css" media="print"><script src="http://meyerweb.com/ui/addresses.js" type="text/javascript"></script><link rel="stylesheet" href="/ui/wordpress.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/tfe.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/home.css" type="text/css" media="screen">
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric" href="/eric/thoughts/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only technical posts)" href="/eric/thoughts/category/tech/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only personal posts)" href="/eric/thoughts/category/personal/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Distractions" href="/eric/thoughts/recent-links/rss2" />
<link rel="alternate" type="application/rss+xml" title="Excuse of the Day" href="/feeds/excuse/rss20.xml" />
</head>
<body id="www-meyerweb-com" class="hpg">

<div id="sitemast"><h1><a href="/"><span>meyerweb</span>.com</a></h1></div><div id="search"><h4>Exploration</h4><!-- SiteSearch Google --><form method="get" action="http://www.google.com/custom" target="_top"><div><input type="hidden" name="domains" value="meyerweb.com"></input><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb"></input><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input><p><input type="radio" name="sitesearch" value="meyerweb.com" checked id="ss1"></input><label for="ss1" title="Search meyerweb.com">meyerweb.com</label><input type="radio" name="sitesearch" value="" id="ss0"></input><label for="ss0" title="Search the Web">Web</label></p><input type="hidden" name="client" value="pub-3772084027748653"></input><input type="hidden" name="forid" value="1"></input><input type="hidden" name="ie" value="ISO-8859-1"></input><input type="hidden" name="oe" value="ISO-8859-1"></input><input type="hidden" name="safe" value="active"></input><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input><input type="hidden" name="hl" value="en"></input></div></form><!-- SiteSearch Google --><!-- <form method="get" action="http://www.google.com/custom"><div><input type="submit" name="sa" value="Search"><input type="text" name="q" size="20" maxlength="255" value=""><input type="hidden" name="sitesearch" value="meyerweb.com"></div></form><small><a href="http://www.google.com/search">Powered by Google</a></small> --></div><div id="main"><div class="skipper">Skip to: <a href="#extra">site navigation/presentation</a></div><div class="skipper">Skip to: <a href="#thoughts">Thoughts From Eric</a></div>
<div id="thoughts">


<div class="entry">
<h3><a href="http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/" rel="bookmark" title="Permanent Link: Regular Expression Help">Regular Expression Help</a></h3>
<ul class="meta">
<li class="date">Wed 27 Oct 2004</li>
<li class="time">1240</li>
<li class="cat"><a href="http://meyerweb.com/eric/thoughts/category/general/" title="View all posts in General" rel="category tag">General</a></li>
<li class="cmt"><a href="http://meyerweb.com/eric/thoughts/2004/10/27/regular-expression-help/#comments">44 responses</a></li>
<li></li><li></li></ul>

<div class="text">
<p>
Some time ago, <a href="http://simon.incutio.com/" title="Simon Willison's Weblog" rel="acquaintance colleague met">Simon Willison</a> pointed out <a href="http://angel.net/~nic/passwdlet.html" title="Password generator bookmarklet">a very cool bookmarklet</a> that helps solve the &#8220;I have one password for all my public sites&#8221; problem.  This is where someone picks a password they can remember, and then uses that as the password for their accounts on Amazon, eBay, Hotmail, Netflix, et cetera.  This is one of those things that security experts tell you never to do, and yet just about everyone does, because given the plethora of accounts most of us maintain, there&#8217;s no way we could keep track of which password goes with which account unless it was all written down somewhere&#8230; and that&#8217;s something the security experts <em>insist</em> that you never, ever do.
</p>
<p>
So the bookmarklet takes your &#8216;master password&#8217;, crosses it with the domain of the site, and generates an MD5-based result.  So let&#8217;s assume meyerweb had accounts.  You would fire off the bookmarklet, which would ask you type in your master password.  So let&#8217;s say your master password is &#8216;passwd&#8217;; this is combined with <tt>www.meyerweb.com</tt> and the resulting password is <tt>68573552</tt>.  On the other hand, if you just use <tt>meyerweb.com</tt>, the result is <tt>92938a6e</tt> 
</p>
<p>
Now, while those aren&#8217;t the most secure possible passwords, they&#8217;re a lot more secure than &#8216;passwd&#8217;.  So I&#8217;d like to make use of this bookmarklet.  Fine, great.  The problem is what you just saw: the generated password changes if the full host and domain name bit changes.  This could be a problem if, say, <tt>amazon.com</tt> suddenly starts routing all logins to a server named <tt>login.amazon.com</tt>&#8230; or vice versa.  So I&#8217;d like to adapt the bookmarklet so it grabs just the domain and TLD (I probably got those terms wrong; I usually do) of a URL.  Problem is, I can&#8217;t write regular expressions for squat.  I don&#8217;t even understand how the regexp in the existing bookmarklet works.</p>
<p>
So, a little help, please?  Given the form <tt>http://www.domain.tld/blah/foo/wow.xyz</tt>, I want the regexp to return just <tt>domain.tld</tt>.  Just leave a solution in the comments, and you&#8217;ll earn the respect and adulation of your peers.  At least those of them who read the comments.
</p></div>

</div>

</div>
<p style="font-size: 90%; text-align: right; margin-top: 0.5em; padding-top: 0;">(If you care, there's even an <a href="/eric/thoughts/page/2/">archive of previous thoughts</a>...)</p>

</div><div id="extra"><div class="panel" id="archipelago"><h4>Identity Archipelago</h4><ul><li><a href="http://flickr.com/photos/meyerweb/" rel="me">Flickr</a></li><li><a href="http://twitter.com/meyerweb/" rel="me">Twitter</a></li><li><a href="http://dopplr.com/traveller/meyerweb">Dopplr</a></li><li><a href="http://www.linkedin.com/in/meyerweb" rel="me">LinkedIn</a></li><li><a href="http://technorati.com/profile/emeyer" rel="me">Technorati</a></li></ul></div><div class="panel" id="pointers"><h4>Projects Elsewhere</h4><ul><li><a href="http://aneventapart.com/">An Event Apart</a></li><li><a href="http://complexspiral.com/">Complex Spiral Consulting</a></li><li><a href="http://www.webassist.com/go/css/emeyer/">CSS Sculptor</a></li><li><a href="http://css-discuss.org/">css-discuss</a></li><li><a href="http://microformats.org/">Microformats</a></li><li><a href="http://s5project.org/">S5</a></li></ul></div><div class="panel" id="tour"><ul><li><a href="http://fray.com/issue3/"><img src="http://fray.com/images/i3c.gif" alt="Fray Contributor (Issue 3: Sex &amp; Death)" /></a></li><!-- <li><a href="http://www.webassist.com/go/css/emeyer/"><img src="/pix/CS_ad_180x109.jpg" alt="CSS Sculptor for Dreamweaver" style="max-width: 100%;" /></a></li> --></ul></div><div class="panel">
<h4>Recently Tweeted</h4>
<p class="more"><a href="http://twitter.com/meyerweb">see more</a></p>
<p>Coffee shop hacking—using a stir-stick to spread cream cheese on my bagel. <small>&#8211;tweeted 11 hours, 28 minutes ago</small></p>
</div><div id="sideblog" class="panel">
<h4>Distractions</h4>
<p class="more">
<a href="/eric/thoughts/recent-links/">archive</a>
</p>
<ul>
<li><a href="http://tweetagewasteland.com/2010/03/my-head-is-in-the-cloud/" title="March 18 | &#8220;I sense that my addiction to the realtime stream is only making room for the consumption of a faster stream.&#8221;">My Head is in the Cloud</a> <small>[via <a href="http://daringfireball.net/">John</a>]</small></li>
<li><a href="http://8bitnyc.com/" title="March 17 | All of a sudden I want to establish a mission in Central Park and negotiate with the natives for gold and food.">8-Bit NYC</a></li>
<li><a href="http://www.youtube.com/watch?v=nFicqklGuB0&amp;feature=player_embedded" title="March 12 | Wry comment expressing my appreciation of the creative derivativeness of this video and its uncanny accuracy in mocking common tropes.">Academy Award Winning Movie Trailer</a></li>
<li><a href="http://www.youtube.com/watch?v=414TmP12WAU" title="March 9 | &#8220;Apple juice&#8230; for half price!&#8221;  More like twice PRICELESS.  (Note: If you&#8217;re at work, don your headphones.)">Happy in Paraguay</a> <small>[via <a href="http://unstoppablerobotninja.com/">Ethan</a>]</small></li>
<li><a href="http://www.youtube.com/watch?v=9V5ubAOeOBk&amp;feature=player_embedded" title="February 10 | This is approximately the best thing ever.">U900 -Walk Don&#8217;t Run (Isogabamaware)</a></li>
<li><a href="http://www.456bereastreet.com/archive/201002/sifr_default_css_hides_content_from_at_least_one_screen_reader/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A 456bereastreet %28456 Berea Street%29" title="February 8 | -9999px comes through again, but I really wish we were beyond that kind of thing.">sIFR default CSS hides content from at least one screen reader</a></li>
<li><a href="http://www.macosxhints.com/article.php?story=20100117064356428" title="February 8 | Storing this for future use.">Take a picture with the iSight camera when a folder is opened</a></li>
<li><a href="http://mingle2.com/blog/view/web-developer-mind" title="February 4 | Mostly valid.  (SEE WHAT I DID THERE?)">The Mind of a Web Developer: An Illustrated Diagram</a></li>
<li><a href="http://www.theonion.com/content/news/science_channel_refuses_to_dumb" title="January 28 | &#8220;Punkin Chunkin, for Christ&#8217;s sake&#8230; What more do you people want?&#8221;">Science Channel Refuses To Dumb Down Science Any Further</a></li>
<li><a href="http://www.mailchimp.com/blog/project-omnivore-declassified/" title="January 27 | Sounds like quite a feat.  But I wonder how we&#8217;d feel if Microsoft or Google announced the same kind of thing on their e-mail services.">MailChimp&#8217;s Project Omnivore: Declassified</a></li>
<li><a href="http://www.politifact.com/truth-o-meter/statements/2010/jan/25/carolyn-maloney/congresswoman-says-democratic-presidents-create-mo/" title="January 26 | &#8220;Obviously, luck matters a lot, but when there is a consistent pattern over more than 60 years, it starts to look like more than just luck.&#8221;">Congresswoman says Democratic presidents create more private-sector jobs</a></li>
<li><a href="http://www.ted.com/talks/taylor_mali_what_teachers_make.html" title="January 25 | Truth.">Taylor Mali: What teachers make</a></li>
<li><a href="http://notebook.johnmartz.com/how-websites-work?c=1" title="January 22 | At last, the truth is out and I can stop pretending:  beatific monkeys are what makes it all go.">How websites work</a></li>
</ul>
</div>
<div class="panel" id="advisory">
<div class="guarded">
<a href="http://blogadvisorysystem.com/"><img src="/pix/bas/guarded.png" alt="Blog Advisory System Alert Level: Guarded"></a>
</div>
</div>

<div class="panel" id="excuse">
<h4>The <a href="/feeds/excuse/">excuse of the day</a> is</h4>
<p>neutrino interactions</p>
</div>

<div class="panel" id="extras">
<h4>Extras</h4>
<ul>
<li><a href="/feeds/">Feeds</a> &#8226;</li>
<li><a href="/eric/faq.html">FAQ</a> &#8226;</li>
<li><a href="/family.html">Family</a></li>
</ul>
</div>

</div>

<div id="navigate">
<h4>Navigation</h4>
<ul id="navlinks">
<li id="archLink"><a href="/eric/thoughts/">Archives</a></li>
<li id="cssLink"><a href="/eric/css/">CSS</a></li>
<li id="toolsLink"><a href="/eric/tools/">Toolbox</a></li>
<li id="writeLink"><a href="/eric/writing.html">Writing</a></li>
<li id="speakLink"><a href="/eric/talks/">Speaking</a></li>
<li id="otherLink"><a href="/other/">Leftovers</a></li>
<li id="aboutsite"><a href="/ui/about.html">About this site</a></li>
</ul>
</div>

<div id="footer">
<p class="sosumi">All contents of this site, unless otherwise noted, are &copy;1995-2008 <strong>Eric A. and Kathryn S. Meyer</strong>.  All Rights Reserved.</p>
<p>"<a href="/eric/thoughts/">Thoughts From Eric</a>" is powered by the &uuml;bercool <a href="http://wordpress.org/">WordPress</a></p>
</div>
</body>
</html>
