<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

<title>Ben Kersten</title>
<link href="http://m68k.net/atom.xml" rel="self"/>
<link href="http://m68k.net/"/>
<updated>2011-05-16T15:04:06-07:00</updated>
<id>http://m68k.net/</id>
<author>
	<name>Ben Kersten</name>
	<email>ben.kersten-m68k@gmail.com</email>
</author>


<entry>
	<title>Gamification is going to bite you in the ass!</title>
	<link href="http://m68k.net/thoughts/2011/05/17/gamification-will-bite-you-in-the-ass.html"/>
	<updated>2011-05-17T00:00:00-07:00</updated>
	<id>http://m68k.net/thoughts/2011/05/17/gamification-will-bite-you-in-the-ass</id>
	<content type="html">&lt;h2&gt;Gamification is going to bite you in the ass!&lt;/h2&gt;
&lt;p&gt;If you&amp;#8217;ve played a video game recently you&amp;#8217;ve probably noticed the achievements and rewards popping up and essentially congratulating you for sticking with it. Although you may be proud of receiving these little achievements they&amp;#8217;re often there to cover up a lack of engagement audiences are having with the game. And they get away with it too, by exploiting the predictability of our behaviour.&lt;/p&gt;
&lt;p&gt;One of the many irrational behaviours that we humans posses is that we can easily be tricked into doing something we&amp;#8217;re not interested in if we receive positive reinforcement on a variable schedule. If the achievement was awarded to us every time we completed the same task we would quickly do the math and decide how little work we can get away with in order to get what we want or if its worth doing the work at all. But when the schedule varies we get sucked into going further and working harder to receive a small reward and can find it really hard to give up. This is the same irrationality that poker machines exploit, and nowadays video games have grown up and learnt to do it too.&lt;/p&gt;
&lt;p&gt;Self proclaimed experts on gaming are now pushing a new approach to motivation in schools and businesses, which they like to call gamification. Its all about employing game mechanics in the work place to make tasks fun and get more out of employees and students.&lt;/p&gt;
&lt;p&gt;One thing these experts probably know is that implementing game play mechanics that are enjoyable is really, really hard. Many games, especially those found on social networking sites, prefer to exploit predictable human behaviour rather than try to make something fun and worthwhile for those participating.&lt;/p&gt;
&lt;p&gt;Fun and enjoyment barely feature among the list of techniques used in gamification, instead taking a back seat to achievements, lottery wins, leveling up, reward schedules, virality, status and loss aversion. All of these techniques can be tied to exploiting many of the predictable human behaviours explored in the book Predictably Irrational by Psychology and Behavioural Economics Professor, Dan Ariely.&lt;/p&gt;
&lt;p&gt;Bad news for the gamification crowd is that fooling people into working harder at something may show good results in the short term but can have overall negative effect in the long term. Exploiting people&amp;#8217;s predictability will bite back and result in a net loss.&lt;/p&gt;
&lt;p&gt;My favourite example of one of the negative effects comes from Dan Pink&amp;#8217;s book Drive. To summarize, three groups of students in a preschool class were given free time. One group were promised awards if they drew, another group was given awards after drawing without being told up front and the third got nothing. After this in subsequent free time, the first group who were promised awards tended more than any of the other two groups not to draw. Their enthusiasm for drawing had been replaced by their eagerness for rewards and without the up front promise they no longer choose to do it for its intrinsic enjoyment.&lt;/p&gt;
&lt;p&gt;The sad reality is that adopting gamification techniques can backfire and quash the intrinsic motivations already in people and create a vicious cycle of needing greater and greater rewards.&lt;/p&gt;</content>
</entry>

<entry>
	<title>Betting on Erlang</title>
	<link href="http://m68k.net/programming/erlang/2011/03/06/betting-on-erlang.html"/>
	<updated>2011-03-06T00:00:00-08:00</updated>
	<id>http://m68k.net/programming/erlang/2011/03/06/betting-on-erlang</id>
	<content type="html">&lt;h2&gt;Betting on Erlang&lt;/h2&gt;
&lt;p&gt;Not long ago I use to work in the Game Development industry where we used C/C++ and Lua to make our games; Python and C# were also used for developing tools. It wasn&amp;#8217;t uncommon to have discussions about programming languages especially being on the engine team and all of us having experience in a range of different languages.&lt;/p&gt;
&lt;p&gt;Some of the time discussions stared with a new scripter asking why we were using Lua instead of Python, which they were more comfortable with, but most of the time it would be somebodies pet project and choice of language that would kick it off.&lt;/p&gt;
&lt;p&gt;One of the more interesting languages that was being used by the lead programmer was Erlang. I had never heard of it before and not having programmed in Prolog the syntax was totally foreign. But my lead would often call me over and show me something cool you could do in the language.&lt;/p&gt;
&lt;p&gt;Late last year Francesco Cesarini, founder of Erlang Solutions, was in town for &lt;span class=&quot;caps&quot;&gt;YOW&lt;/span&gt;!2010 and was holding an Erlang workshop on a Saturday. So I thought it best that I go along and give the language at least half a day of my undivided attention to see if I liked it.&lt;/p&gt;
&lt;p&gt;Holy Shit! Ignoring syntactic differences this was a completely different style of programming than what I was used to, and I liked it. No need for defensive programming, the VM halts any failed process without taking your whole app down. Concurrency comes free as a by-product of sharing nothing. Hot Swapping. Garbage Collection. Need I go on.&lt;/p&gt;
&lt;p&gt;If your a programmer who hasn&amp;#8217;t yet picked which of the concurrent languages to choose for the scary multi-core future, but you do know that threads are going to drive you to madness, then I recommend taking a closer look at Erlang.&lt;/p&gt;
&lt;p&gt;Our lead did eventually get to do a game project in Erlang when we made our first facebook game. It will probably take me a year of unfinished projects before I become proficient in the language but I&amp;#8217;m looking forward to it.&lt;/p&gt;</content>
</entry>

<entry>
	<title>Stop searching for regular expressions</title>
	<link href="http://m68k.net/programming/boost/2010/09/01/stop-searching-for-regular-expressions.html"/>
	<updated>2010-09-01T00:00:00-07:00</updated>
	<id>http://m68k.net/programming/boost/2010/09/01/stop-searching-for-regular-expressions</id>
	<content type="html">&lt;h2&gt;Stop searching for regular expressions&lt;/h2&gt;
&lt;p&gt;The last time I needed to program up a way of validating URLs, I did a quick search for &amp;#8216;url regex&amp;#8217; before stopping and thinking &amp;#8220;&lt;span class=&quot;caps&quot;&gt;WTF&lt;/span&gt; am I doing!&amp;#8221; If your anything like me you probably first reach for regular expressions when needing to search within or validate strings. No need to parse each character and write a finite state machine, regular expression libraries do it for us. They are incredibly powerful.&lt;/p&gt;
&lt;p&gt;But before you practice code reuse stop one moment and think, do I really understand the problem? Searching for a regex to solve your problem is the first sign of having little to no idea. Not only are regular expressions cryptic to decipher and maintain but almost all of them you can find on developers blogs, tech articles or sites dedicated to collecting &amp;#8220;a regex for all occasions&amp;#8221; are incomplete or have bugs.&lt;/p&gt;
&lt;p&gt;What you really want, what you can consume quickly and what helps you really understand how to write your own regex is the protocols specification in Backus-Naur Form. The &amp;#8216;Universal Resource Locator&amp;#8217; specification is found in RFC1738 and contains the easily readable &lt;span class=&quot;caps&quot;&gt;BNF&lt;/span&gt; for all parts including http, ftp, and even gopher. You&amp;#8217;ll never find a specification written in anything resembling a perl regex so why look at regular expressions first?&lt;/p&gt;
&lt;p&gt;For my solution it was necessary to write it in C++, so naturally I chose to use boost which provides a few options including my new favourite Xpressive. Xpressive is easy to use and you can almost copy and paste &lt;span class=&quot;caps&quot;&gt;BNF&lt;/span&gt; right into your editor and compile. All it needs is some reordering and a bit of syntactic sugar and hey presto your done. Its also readable like the original &lt;span class=&quot;caps&quot;&gt;BNF&lt;/span&gt; so if you chose to leave something out (like gopher support) someone else can maintain it without feeling the urge to cause you harm.&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;cpp&quot;&gt;&lt;span class=&quot;cp&quot;&gt;#include &amp;lt;boost/xpressive/xpressive.hpp&amp;gt;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;namespace&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;boost&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xpressive&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kt&quot;&gt;bool&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;validate_url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;std&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// http://&amp;lt;host&amp;gt;:&amp;lt;port&amp;gt;/&amp;lt;path&amp;gt;?&amp;lt;searchpart&amp;gt;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;domainlabel&lt;/span&gt;    &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;toplabel&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alnum&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostname&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;domainlabel&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;toplabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostnumber&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostnumber&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostport&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;host&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;port&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;safe&lt;/span&gt;           &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as_xpr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;$&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;-&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;_&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;.&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;+&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;extra&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;as_xpr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;quot;!&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;(&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;)&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;,&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unreserved&lt;/span&gt;     &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alpha&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;digit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;safe&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;extra&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;escape&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xdigit&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// &amp;quot;%&amp;quot; hex hex&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uchar&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;unreserved&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;escape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hsegment&lt;/span&gt;       &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uchar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;=&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;search&lt;/span&gt;         &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;uchar&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;:&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;@&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;&amp;amp;&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;=&amp;quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hpath&lt;/span&gt;          &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hsegment&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hsegment&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;httpurl&lt;/span&gt;        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;http://&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hostport&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;hpath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;quot;?&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;search&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;sregex&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;url_regex&lt;/span&gt;      &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;httpurl&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;regex_match&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;url_regex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;And just so you know I coded this in a text editor and didn&amp;#8217;t try compiling it, so I&amp;#8217;m at no risk of breaking the great internet tradition of buggy regular expressions :)&lt;/p&gt;
&lt;p&gt;PS. It&amp;#8217;s also incomplete so don&amp;#8217;t think you won&amp;#8217;t have to code it up yourself even if it does compile.&lt;/p&gt;</content>
</entry>


</feed>
