Skip to content

Instantly share code, notes, and snippets.

View igitur's full-sized avatar

Francois Botha igitur

  • Cape Town, South Africa
View GitHub Profile
@igitur
igitur / woof3.py
Created August 6, 2018 12:47 — forked from p1-olm/woof3.py
woof.py fork with Python3 support and PEP8 compliant (http://www.home.unix-ag.org/simon/woof.html)
#!/usr/bin/env python3
#
# woof -- an ad-hoc single file webserver
# Copyright (C) 2004-2009 Simon Budig <simon@budig.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
@igitur
igitur / south_african_full_name_regex.md
Last active March 3, 2024 17:48
Regular expressions to parse South African full names into first names and last name

Regular expressions to parse full names

Given a set of full names (multiple first names and last name/surname combined), these regular expressions can be used to split up the string into first names and a single last name/surname. This takes into account some common Afrikaans surnames with muliple parts (e.g. van der Merwe). These regular expressions are not perfect and cannot cover all cases. Adapt it for your needs. Use the capture groups to retrieve the first names and surname.

Format: First names Surname

([\w-]+(?: +(?!(?:Le +\w+)|(?:D[eou] +\w+)|(?:(?:Janse +)?V[ao]n +(?:Der +)?\w+))[\w-]+)*) +((?:[\w-]+ )*[\w-]+)

Examples

Input Output first name(s) Output surname
Sibusiso Madikizela Sibusiso Madikizela