Provide a generic way to work out if a url is valid.

This is far more extensible than using a per-case match & check.

Change-Id: I28aaaaf3bb5fa4db840e5860ebf6ef68b76ed4e0
Add validation for trac wiki pages too.

Change-Id: Iaf661f6e380f1a2e8684da96d7f8c1783890c681
Allow some punctuation after an id match.

This allows for using things in sentences, such as "let's fix #12.".

Change-Id: I344e2f486530a30a7c0011f22ebbc0ef8c133f4b