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
1105053478Måns Grebäck2018-08-15Sweden
222476627Pizzadude - Jakob Fischer2018-08-15Denmark
34482752Johan Waldenström2018-08-15Sweden
43383418Mr.fisk Fonts - Mike Larsson2018-08-15Sweden
53228048Carl Krull2018-08-15Denmark
63213926Fontourist - Hans Gerhard Meier2018-08-15Norway
72696364Listemageren - Klaus Johansen2018-08-15Denmark
82549288Johan Aakerlund2018-08-15Denmark
92381537CheapProFonts - Roger S. Nelsson2018-08-15Norway
111252004Flight of the Dragon - Hasan Guven2018-08-15Norway
121046455Christian Munk2018-08-15Denmark
13711443Your Own Font - Ellinor Rapp2018-08-15Sweden
14549289Vinterstille TypeFaceLab - Klaus Nielsen2018-08-15Denmark
15548663Adam Ericsson2018-08-15Sweden
17478246Viktor Hammarberg2018-08-15Sweden
18434258Moonbase Press - Svein Kåre Gunnarson2018-08-15Norway
19405213Espen Morten Kvalheim2018-08-15Norway
20349163Staffan Vilcans2018-08-15Sweden
21320365Martin Holm2018-08-15Norway
22319423Thor Christopher Arisland2018-08-15Norway
23313542Jonas Borneland Hansen2018-08-15Denmark
24232922Norwegian Ink / Design for Dough - Frode Nordbø2018-08-15Norway
25204647Anton - Anton Lundström2018-08-15Sweden
26204352David Engelby2018-08-15Denmark
27197461dawnland - Daniel Viberg2018-08-15Sweden
28174658211178 Creative Agency - Morten Talleivsen2018-08-15Norway
29132431Martin Sørensen2018-08-15Denmark
3191577Andreas Larsen2018-08-15Denmark
3289783Nils Kähler2018-08-15Denmark
3389454Joaquim Marquès Nielsen2018-08-15Denmark
3482460Pär Lundkvist2018-08-15Sweden
3581362Anton Bohlin2018-08-15Sweden
3675469Digital Flame Studios - sindre små2018-08-15Norway
3862578huskmelk - Rashid Akrim2018-08-15Norway
3960365Kyrre Honohan2018-08-15Norway
4054773Pia Hed Aspell2018-08-15Sweden
4152950Nadia Rosenfeldt2018-08-15Denmark
4251262Linn Mustanoja2018-08-15Sweden
4348790Lars Håhus2018-08-15Sweden
4443621ronjam - Ronja Melcker2018-08-15Sweden
4540805Atle Mo2018-08-15Norway
4635944Erik Jeddere-Fisher2018-08-15Norway
4832113benjamin rauber2018-08-15Sweden
4930891Arman Ay2018-08-15Sweden
5026875Mark Lund2018-08-15Norway
5125818Botond Bokor2018-08-15Sweden
5225801Andrew Nordquist2018-08-15Sweden
5425718Dan Thorup2018-08-15Denmark
5524420Aske Ching2018-08-15Denmark
5721040Carl Enlund2018-08-15Sweden
5820587Bull - Sandra Madsen2018-08-15Denmark
5920237Henrik Johansson2018-08-15Sweden
6020197David Lindecrantz2018-08-15Sweden
6120025Erik Holm2018-08-15Norway
6219772Kristian Dalen2018-08-15Norway
6316964Mandy Pandy2018-08-15Sweden
6416640Studio Indigo - Helena Öhman2018-08-15Sweden
6514532Christian Koch2018-08-15Denmark
6612918Alexander Rossebø2018-08-15Norway
6712518Johan Brodd2018-08-15Sweden
6811158Viktor Örneland2018-08-15Sweden
699507Mathias Alvebring2018-08-15Sweden
727514Mathias Rue2018-08-15Denmark
736855Manuela Hardy2018-08-15Norway
756511Sara Lindberg2018-08-15Sweden
766497Gröt Havregrynsson2018-08-15Sweden
776272Mattis Folkestad2018-08-15Norway
785465Oliver Waldemar2018-08-15Sweden
794907Simon Jakobsson2018-08-15Sweden
804211KingDGaming - Elias Eriksson2018-08-15Sweden

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: