hotosm/osm-tasking-manager2 — pull request #473 by bgirardot (2014-11-29 02:20:08+00:00)
Title: Changes TM2 home page search box to also find by project number

fixes #160 This change adds the ability to enter a bare project number (nnn will stand in for a generic project number of any length), the words "project nnn", "task nnn" or any arbitrary string and a project number and if there is a project.id matching that number it will add the project with that number to the search results. It is intended to cover the 99% of the cases where a user just want to search for a project by number, if they can get the number in it will find the project for them.

It will fail to find a project by number if there are other numbers in the search text, for example two project numbers. Then the existing search facility would handle that search, which it always does anyway as well.

The extra hit on the db should be fast and is just an int comparison. regex is a go to tool for me so I used it and had to include the re module.