Fontstats Plugin

Today I finished a little WordPress plugin I’ve been working on.

It’s a two part plugin, one php script collects data from any Norwegian designer on DaFont by visiting each site, and by the power of Regex-Grayskull it inserts it into a database on my website.

The WordPress plugin then selects the last sampled date and displays it in a HTML-table on any post or page where I insert the registered shortcode.

Here’s the result:

No.DownloadsDesignerDate SampledCountry
1114253161Måns Grebäck2020-01-07Sweden
224310894Pizzadude - Jakob Fischer2020-01-07Denmark
34706444Johan Waldenström2020-01-07Sweden
43688142Carl Krull2020-01-07Denmark
53257837Fontourist - Hans Gerhard Meier2020-01-07Norway
63103842Johan Aakerlund2020-01-07Denmark
72791199Listemageren - Klaus Johansen2020-01-07Denmark
82535567CheapProFonts - Roger S. Nelsson2020-01-07Norway
92118812HENRIavecunK - Henrik2020-01-07Sweden
101307625Flight of the Dragon - Hasan Guven2020-01-07Norway
111147906Christian Munk2020-01-07Denmark
12788476Adam Ericsson2020-01-07Sweden
14720588Your Own Font - Ellinor Rapp2020-01-07Sweden
15563651Vinterstille TypeFaceLab - Klaus Nielsen2020-01-07Denmark
16517542Viktor Hammarberg2020-01-07Sweden
17499359Moonbase Press - Svein Kåre Gunnarson2020-01-07Norway
18411324Espen Morten Kvalheim2020-01-07Norway
19406960Thor Christopher Arisland2020-01-07Norway
20359132Staffan Vilcans2020-01-07Sweden
21350604Martin Holm2020-01-07Norway
22321480Jonas Borneland Hansen2020-01-07Denmark
23293541Lene Arensdorff2020-01-07Denmark
24238736Norwegian Ink / Design for Dough - Frode Nordbø2020-01-07Norway
25212548David Engelby2020-01-07Denmark
26209131Anton - Anton Lundström2020-01-07Sweden
27201343dawnland - Daniel Viberg2020-01-07Sweden
28182792211178 Creative Agency - Morten Talleivsen2020-01-07Norway
29145805Martin Sørensen2020-01-07Denmark
30126793Andreas Larsen2020-01-07Denmark
31117780Nils Kähler2020-01-07Denmark
32100964Bolahool Graphics2020-01-07Sweden
3491763Anton Bohlin2020-01-07Sweden
3591116Joaquim Marquès Nielsen2020-01-07Denmark
3683165Pär Lundkvist2020-01-07Sweden
3777342Carl Enlund2020-01-07Sweden
3876231Digital Flame Studios - sindre små2020-01-07Norway
4065842huskmelk - Rashid Akrim2020-01-07Norway
4161062Kyrre Honohan2020-01-07Norway
4255835Pia Hed Aspell2020-01-07Sweden
4354804Nadia Rosenfeldt2020-01-07Denmark
4452527Linn Mustanoja2020-01-07Sweden
4551626Lars Håhus2020-01-07Sweden
4645557ronjam - Ronja Melcker2020-01-07Sweden
4743167Atle Mo2020-01-07Norway
4837189Erik Jeddere-Fisher2020-01-07Norway
4935049Arman Ay2020-01-07Sweden
5035008Benjamin Blåholtz2020-01-07Sweden
5134626benjamin rauber2020-01-07Sweden
5330867Studio Indigo - Helena Öhman2020-01-07Sweden
5428446Christian Koch2020-01-07Denmark
5527551Mark Lund2020-01-07Norway
5627495Botond Bokor2020-01-07Sweden
5727099Dan Thorup2020-01-07Denmark
5826377Andrew Nordquist2020-01-07Sweden
6025194Aske Ching2020-01-07Denmark
6122367Erik Holm2020-01-07Norway
6321430Henrik Johansson2020-01-07Sweden
6421048Bull - Sandra Madsen2020-01-07Denmark
6520972David Lindecrantz2020-01-07Sweden
6620119Kristian Dalen2020-01-07Norway
6717480Mandy Pandy2020-01-07Sweden
6814389Alexander Rossebø2020-01-07Norway
6912902Johan Brodd2020-01-07Sweden
7011934Viktor Örneland2020-01-07Sweden
7110165Mathias Alvebring2020-01-07Sweden
747783Mathias Rue2020-01-07Denmark
757407Gröt Havregrynsson2020-01-07Sweden
767383Manuela Hardy2020-01-07Norway
787006Sara Lindberg2020-01-07Sweden
796567Mattis Folkestad2020-01-07Norway
806389Oliver Waldemar2020-01-07Sweden
815325Simon Jakobsson2020-01-07Sweden
824486KingDGaming - Elias Eriksson2020-01-07Sweden

Regex 101

Today I received an email from the store I used to work at asking me to make a printer friendly version of an online table of information.

As I learned more about regular expressions from the “INF3331” course I took this fall, solving this problem proved to be way easier than any previous attempts at the likes of it.

At times I’ve thought that regexes are harder to read and debug than ordinary programming languages, but with a good editor like Atom or the regex101 page, it all became a lot less stressful.

As far as editors go, I have to admit that I still use emacs when I’m not using an IDE or GUI-editor.

Note to self about regular expressions.

(.*?) to capture zero or more characters in a non-greedy manner

(?:.*?) for the same grouping without backreferences.

$1 or $[group-number] for backreferences in JavaScript and Atom

\1 or \[group-number] for backreferences in Python, PHP.

Perl and PHP also uses \g1 or \g[group-number] for backreferences.

The following characters need to be escaped in regex: