Add ability to specify the pattern to be recognised