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
1110703011Måns Grebäck2019-06-18Sweden
223603480Pizzadude - Jakob Fischer2019-06-18Denmark
34601855Johan Waldenström2019-06-18Sweden
43508400Carl Krull2019-06-18Denmark
53243218Fontourist - Hans Gerhard Meier2019-06-18Norway
62876572Johan Aakerlund2019-06-18Denmark
72755319Listemageren - Klaus Johansen2019-06-18Denmark
82475412CheapProFonts - Roger S. Nelsson2019-06-18Norway
91931436HENRIavecunK - Henrik2019-06-18Sweden
101286072Flight of the Dragon - Hasan Guven2019-06-18Norway
111111986Christian Munk2019-06-18Denmark
12717268Your Own Font - Ellinor Rapp2019-06-18Sweden
13707835Adam Ericsson2019-06-18Sweden
15558187Vinterstille TypeFaceLab - Klaus Nielsen2019-06-18Denmark
16503617Viktor Hammarberg2019-06-18Sweden
17473795Moonbase Press - Svein Kåre Gunnarson2019-06-18Norway
18409078Espen Morten Kvalheim2019-06-18Norway
19382978Thor Christopher Arisland2019-06-18Norway
20355251Staffan Vilcans2019-06-18Sweden
21339516Martin Holm2019-06-18Norway
22318811Jonas Borneland Hansen2019-06-18Denmark
23236570Norwegian Ink / Design for Dough - Frode Nordbø2019-06-18Norway
24209553David Engelby2019-06-18Denmark
25207576Anton - Anton Lundström2019-06-18Sweden
26199974dawnland - Daniel Viberg2019-06-18Sweden
27179695211178 Creative Agency - Morten Talleivsen2019-06-18Norway
28140753Martin Sørensen2019-06-18Denmark
29111103Andreas Larsen2019-06-18Denmark
30106803Nils Kähler2019-06-18Denmark
3198291Bolahool Graphics2019-06-18Sweden
3390460Joaquim Marquès Nielsen2019-06-18Denmark
3487822Anton Bohlin2019-06-18Sweden
3582908Pär Lundkvist2019-06-18Sweden
3675960Digital Flame Studios - sindre små2019-06-18Norway
3864649huskmelk - Rashid Akrim2019-06-18Norway
3960792Kyrre Honohan2019-06-18Norway
4055449Pia Hed Aspell2019-06-18Sweden
4154155Nadia Rosenfeldt2019-06-18Denmark
4252134Linn Mustanoja2019-06-18Sweden
4350567Lars Håhus2019-06-18Sweden
4444871ronjam - Ronja Melcker2019-06-18Sweden
4542343Atle Mo2019-06-18Norway
4636746Erik Jeddere-Fisher2019-06-18Norway
4733693benjamin rauber2019-06-18Sweden
4833675Arman Ay2019-06-18Sweden
5027454Studio Indigo - Helena Öhman2019-06-18Sweden
5127329Mark Lund2019-06-18Norway
5226870Botond Bokor2019-06-18Sweden
5326599Dan Thorup2019-06-18Denmark
5426573Carl Enlund2019-06-18Sweden
5526168Andrew Nordquist2019-06-18Sweden
5724942Aske Ching2019-06-18Denmark
5921458Erik Holm2019-06-18Norway
6021199Benjamin Blåholtz2019-06-18Sweden
6120998Henrik Johansson2019-06-18Sweden
6220878Bull - Sandra Madsen2019-06-18Denmark
6320676David Lindecrantz2019-06-18Sweden
6419998Kristian Dalen2019-06-18Norway
6517302Mandy Pandy2019-06-18Sweden
6615135Christian Koch2019-06-18Denmark
6713602Alexander Rossebø2019-06-18Norway
6812752Johan Brodd2019-06-18Sweden
6911654Viktor Örneland2019-06-18Sweden
709930Mathias Alvebring2019-06-18Sweden
737685Mathias Rue2019-06-18Denmark
747201Manuela Hardy2019-06-18Norway
757068Gröt Havregrynsson2019-06-18Sweden
776830Sara Lindberg2019-06-18Sweden
786456Mattis Folkestad2019-06-18Norway
796028Oliver Waldemar2019-06-18Sweden
805159Simon Jakobsson2019-06-18Sweden
814396KingDGaming - Elias Eriksson2019-06-18Sweden

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: