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
1113742462Måns Grebäck2019-12-10Sweden
224232419Pizzadude - Jakob Fischer2019-12-10Denmark
34695153Johan Waldenström2019-12-10Sweden
43666428Carl Krull2019-12-10Denmark
53256156Fontourist - Hans Gerhard Meier2019-12-10Norway
63080551Johan Aakerlund2019-12-10Denmark
72786950Listemageren - Klaus Johansen2019-12-10Denmark
82527566CheapProFonts - Roger S. Nelsson2019-12-10Norway
92097671HENRIavecunK - Henrik2019-12-10Sweden
101305016Flight of the Dragon - Hasan Guven2019-12-10Norway
111143533Christian Munk2019-12-10Denmark
12780667Adam Ericsson2019-12-10Sweden
13764368bogstav2019-12-10Denmark
14720169Your Own Font - Ellinor Rapp2019-12-10Sweden
15563128Vinterstille TypeFaceLab - Klaus Nielsen2019-12-10Denmark
16515839Viktor Hammarberg2019-12-10Sweden
17496206Moonbase Press - Svein Kåre Gunnarson2019-12-10Norway
18411053Espen Morten Kvalheim2019-12-10Norway
19404516Thor Christopher Arisland2019-12-10Norway
20358640Staffan Vilcans2019-12-10Sweden
21349295Martin Holm2019-12-10Norway
22321174Jonas Borneland Hansen2019-12-10Denmark
23292210Lene Arensdorff2019-12-10Denmark
24238474Norwegian Ink / Design for Dough - Frode Nordbø2019-12-10Norway
25212223David Engelby2019-12-10Denmark
26208971Anton - Anton Lundström2019-12-10Sweden
27201173dawnland - Daniel Viberg2019-12-10Sweden
28182454211178 Creative Agency - Morten Talleivsen2019-12-10Norway
29145271Martin Sørensen2019-12-10Denmark
30125277Andreas Larsen2019-12-10Denmark
31116689Nils Kähler2019-12-10Denmark
32100703Bolahool Graphics2019-12-10Sweden
3394980McKack2019-12-10Norway
3491304Anton Bohlin2019-12-10Sweden
3591020Joaquim Marquès Nielsen2019-12-10Denmark
3683131Pär Lundkvist2019-12-10Sweden
3776198Digital Flame Studios - sindre små2019-12-10Norway
3873933Carl Enlund2019-12-10Sweden
3973765Intense2019-12-10Norway
4065736huskmelk - Rashid Akrim2019-12-10Norway
4161029Kyrre Honohan2019-12-10Norway
4255782Pia Hed Aspell2019-12-10Sweden
4354745Nadia Rosenfeldt2019-12-10Denmark
4452475Linn Mustanoja2019-12-10Sweden
4551514Lars Håhus2019-12-10Sweden
4645491ronjam - Ronja Melcker2019-12-10Sweden
4743087Atle Mo2019-12-10Norway
4837149Erik Jeddere-Fisher2019-12-10Norway
4934909Arman Ay2019-12-10Sweden
5034492benjamin rauber2019-12-10Sweden
5134176Benjamin Blåholtz2019-12-10Sweden
5233625charmingfan2019-12-10Denmark
5330503Studio Indigo - Helena Öhman2019-12-10Sweden
5428266Christian Koch2019-12-10Denmark
5527525Mark Lund2019-12-10Norway
5627425Botond Bokor2019-12-10Sweden
5727052Dan Thorup2019-12-10Denmark
5826346Andrew Nordquist2019-12-10Sweden
5925984Lisa2019-12-10Norway
6025162Aske Ching2019-12-10Denmark
6122265Erik Holm2019-12-10Norway
6221998Andreas2019-12-10Sweden
6321380Henrik Johansson2019-12-10Sweden
6421025Bull - Sandra Madsen2019-12-10Denmark
6520942David Lindecrantz2019-12-10Sweden
6620111Kristian Dalen2019-12-10Norway
6717460Mandy Pandy2019-12-10Sweden
6814305Alexander Rossebø2019-12-10Norway
6912894Johan Brodd2019-12-10Sweden
7011906Viktor Örneland2019-12-10Sweden
7110143Mathias Alvebring2019-12-10Sweden
729813Boksen2019-12-10Norway
737982vardcentralen2019-12-10Sweden
747773Mathias Rue2019-12-10Denmark
757375Gröt Havregrynsson2019-12-10Sweden
767361Manuela Hardy2019-12-10Norway
777025Caesar2019-12-10Sweden
786990Sara Lindberg2019-12-10Sweden
796556Mattis Folkestad2019-12-10Norway
806350Oliver Waldemar2019-12-10Sweden
815312Simon Jakobsson2019-12-10Sweden
824480KingDGaming - Elias Eriksson2019-12-10Sweden
831167Simon2019-12-10Sweden

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:

.^$*+?()[{\|