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
1107623175Måns Grebäck2018-12-18Sweden
222893524Pizzadude - Jakob Fischer2018-12-18Denmark
34531203Johan Waldenström2018-12-18Sweden
43403811Mr.fisk Fonts - Mike Larsson2018-12-18Sweden
53343239Carl Krull2018-12-18Denmark
63227299Fontourist - Hans Gerhard Meier2018-12-18Norway
72720638Listemageren - Klaus Johansen2018-12-18Denmark
82674281Johan Aakerlund2018-12-18Denmark
92420797CheapProFonts - Roger S. Nelsson2018-12-18Norway
101712104HENRIavecunK - Henrik2018-12-18Sweden
111265593Flight of the Dragon - Hasan Guven2018-12-18Norway
121074932Christian Munk2018-12-18Denmark
13713833Your Own Font - Ellinor Rapp2018-12-18Sweden
15617794Adam Ericsson2018-12-18Sweden
16552992Vinterstille TypeFaceLab - Klaus Nielsen2018-12-18Denmark
17489794Viktor Hammarberg2018-12-18Sweden
18450060Moonbase Press - Svein Kåre Gunnarson2018-12-18Norway
19406857Espen Morten Kvalheim2018-12-18Norway
20351711Staffan Vilcans2018-12-18Sweden
21345054Thor Christopher Arisland2018-12-18Norway
22327613Martin Holm2018-12-18Norway
23315653Jonas Borneland Hansen2018-12-18Denmark
24234401Norwegian Ink / Design for Dough - Frode Nordbø2018-12-18Norway
25206490David Engelby2018-12-18Denmark
26205992Anton - Anton Lundström2018-12-18Sweden
27198538dawnland - Daniel Viberg2018-12-18Sweden
28176882211178 Creative Agency - Morten Talleivsen2018-12-18Norway
29135811Martin Sørensen2018-12-18Denmark
3098722Andreas Larsen2018-12-18Denmark
3196204Nils Kähler2018-12-18Denmark
3296004Bolahool Graphics2018-12-18Sweden
3489920Joaquim Marquès Nielsen2018-12-18Denmark
3583952Anton Bohlin2018-12-18Sweden
3682628Pär Lundkvist2018-12-18Sweden
3775649Digital Flame Studios - sindre små2018-12-18Norway
3963361huskmelk - Rashid Akrim2018-12-18Norway
4060550Kyrre Honohan2018-12-18Norway
4155076Pia Hed Aspell2018-12-18Sweden
4253458Nadia Rosenfeldt2018-12-18Denmark
4351606Linn Mustanoja2018-12-18Sweden
4449533Lars Håhus2018-12-18Sweden
4544146ronjam - Ronja Melcker2018-12-18Sweden
4641447Atle Mo2018-12-18Norway
4736247Erik Jeddere-Fisher2018-12-18Norway
4932772benjamin rauber2018-12-18Sweden
5032257Arman Ay2018-12-18Sweden
5127065Mark Lund2018-12-18Norway
5226277Botond Bokor2018-12-18Sweden
5326051Dan Thorup2018-12-18Denmark
5425953Andrew Nordquist2018-12-18Sweden
5624643Aske Ching2018-12-18Denmark
5723667Carl Enlund2018-12-18Sweden
5821812Studio Indigo - Helena Öhman2018-12-18Sweden
6020710Bull - Sandra Madsen2018-12-18Denmark
6120652Erik Holm2018-12-18Norway
6220546Henrik Johansson2018-12-18Sweden
6320392David Lindecrantz2018-12-18Sweden
6419876Kristian Dalen2018-12-18Norway
6517130Mandy Pandy2018-12-18Sweden
6614784Christian Koch2018-12-18Denmark
6713208Alexander Rossebø2018-12-18Norway
6812634Johan Brodd2018-12-18Sweden
6911340Viktor Örneland2018-12-18Sweden
709703Mathias Alvebring2018-12-18Sweden
737595Mathias Rue2018-12-18Denmark
747004Manuela Hardy2018-12-18Norway
756739Gröt Havregrynsson2018-12-18Sweden
776652Sara Lindberg2018-12-18Sweden
786349Mattis Folkestad2018-12-18Norway
795682Oliver Waldemar2018-12-18Sweden
805035Simon Jakobsson2018-12-18Sweden
814295KingDGaming - Elias Eriksson2018-12-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: