Archive for the ‘Formal Language’ Category

SVN Tip: Find/Grep but excluding .svn (Linux)

Saturday, 5 February 2011

Here I give Linux commands to allow the searching for filenames or strings within files without descending into the <.svn> subdirectories.

(more…)

Advertisements

Date Regex; Leap Years

Friday, 16 October 2009

It’s suprising what can be expressed using regular expressions. I tend to think of these at syntactic, but sometimes they can seem almost semantic.

Take dates, for instance, in the format “DD/MM/YYYY”

The months have varying numbers of days. In the Gregorian calendar, a year is a leap year if it is divisible by 4, unless it’s divisible by 100, unless it’s divisible by 400. So, for example, the years 2008 and 2012 are leap years, but the year 2100 is not, but the year 2000 is. This can all be expressed in a regex.

(more…)