Category: Regular Expressions


iPad detection the right way

April 23rd, 2010 — 11:22am
iPad in action

The famous large flat thing slightly more useful than a rock

Here at Konstellation, we just launched the PageGangster for mobile devices including iPad, iPhone, iPod touch and Android. I developed the clientside for this in JavaScript and we launched it with automatic user agent detection serverside. But this had some problems.

Continue reading »

3 comments » | JavaScript, Konstellation, Regular Expressions, Trends

Using the regular expression backtracking engine for prime number magic

July 16th, 2009 — 4:13pm

I just saw the most impressive, intelligent use of the regular expression backtracking engine and simply have to re-post it in order to give my own decryption of the infinitely simple expression. In short, it is a regular expression, that only matches non-prime sequences of 1′s. And it goes like this:

/^1?$|^(11+?)\1+$/

I will try to explain it in a simple way and then do some benchmarking on this simple expression, a slightly optimized version of the expression as well as compare it to more optimal algorithms.

Continue reading »

Comment » | JavaScript, Regular Expressions, Trends

Back to top

Get Adobe Flash playerPlugin by wpburn.com wordpress themes