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
1109796821Måns Grebäck2019-04-21Sweden
223405702Pizzadude - Jakob Fischer2019-04-21Denmark
34579114Johan Waldenström2019-04-21Sweden
43457243Carl Krull2019-04-21Denmark
53238429Fontourist - Hans Gerhard Meier2019-04-21Norway
62809763Johan Aakerlund2019-04-21Denmark
72744197Listemageren - Klaus Johansen2019-04-21Denmark
82458775CheapProFonts - Roger S. Nelsson2019-04-21Norway
91878538HENRIavecunK - Henrik2019-04-21Sweden
101279622Flight of the Dragon - Hasan Guven2019-04-21Norway
111101478Christian Munk2019-04-21Denmark
12716181Your Own Font - Ellinor Rapp2019-04-21Sweden
13680093Adam Ericsson2019-04-21Sweden
15556495Vinterstille TypeFaceLab - Klaus Nielsen2019-04-21Denmark
16499880Viktor Hammarberg2019-04-21Sweden
17466674Moonbase Press - Svein Kåre Gunnarson2019-04-21Norway
18408387Espen Morten Kvalheim2019-04-21Norway
19372969Thor Christopher Arisland2019-04-21Norway
20354205Staffan Vilcans2019-04-21Sweden
21335706Martin Holm2019-04-21Norway
22317895Jonas Borneland Hansen2019-04-21Denmark
23235946Norwegian Ink / Design for Dough - Frode Nordbø2019-04-21Norway
24208638David Engelby2019-04-21Denmark
25207079Anton - Anton Lundström2019-04-21Sweden
26199508dawnland - Daniel Viberg2019-04-21Sweden
27178837211178 Creative Agency - Morten Talleivsen2019-04-21Norway
28139275Martin Sørensen2019-04-21Denmark
29106769Andreas Larsen2019-04-21Denmark
30103068Nils Kähler2019-04-21Denmark
3197552Bolahool Graphics2019-04-21Sweden
3390302Joaquim Marquès Nielsen2019-04-21Denmark
3486525Anton Bohlin2019-04-21Sweden
3582830Pär Lundkvist2019-04-21Sweden
3675856Digital Flame Studios - sindre små2019-04-21Norway
3864184huskmelk - Rashid Akrim2019-04-21Norway
3960716Kyrre Honohan2019-04-21Norway
4055330Pia Hed Aspell2019-04-21Sweden
4153949Nadia Rosenfeldt2019-04-21Denmark
4251987Linn Mustanoja2019-04-21Sweden
4350276Lars Håhus2019-04-21Sweden
4444647ronjam - Ronja Melcker2019-04-21Sweden
4542059Atle Mo2019-04-21Norway
4636607Erik Jeddere-Fisher2019-04-21Norway
4833421benjamin rauber2019-04-21Sweden
4933233Arman Ay2019-04-21Sweden
5027256Mark Lund2019-04-21Norway
5126685Botond Bokor2019-04-21Sweden
5226419Dan Thorup2019-04-21Denmark
5326099Andrew Nordquist2019-04-21Sweden
5525712Carl Enlund2019-04-21Sweden
5625322Studio Indigo - Helena Öhman2019-04-21Sweden
5724854Aske Ching2019-04-21Denmark
5921232Erik Holm2019-04-21Norway
6020885Henrik Johansson2019-04-21Sweden
6120823Bull - Sandra Madsen2019-04-21Denmark
6220591David Lindecrantz2019-04-21Sweden
6319951Kristian Dalen2019-04-21Norway
6417260Mandy Pandy2019-04-21Sweden
6515030Christian Koch2019-04-21Denmark
6613494Alexander Rossebø2019-04-21Norway
6712718Johan Brodd2019-04-21Sweden
6811558Viktor Örneland2019-04-21Sweden
699864Mathias Alvebring2019-04-21Sweden
718586Benjamin Blåholtz2019-04-21Sweden
737661Mathias Rue2019-04-21Denmark
747146Manuela Hardy2019-04-21Norway
756956Gröt Havregrynsson2019-04-21Sweden
776779Sara Lindberg2019-04-21Sweden
786423Mattis Folkestad2019-04-21Norway
795894Oliver Waldemar2019-04-21Sweden
805124Simon Jakobsson2019-04-21Sweden
814359KingDGaming - Elias Eriksson2019-04-21Sweden

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: