twitter/typeahead.js — pull request #624 by lukekarrys (2014-01-27 23:51:19+00:00)
Title: Only trigger typeahead on character/regex (@-mentions)

Not sure this is completely ready to merge yet, but it's working for me in a production app. I also looked around quite a bit for something that would do this, so hopefully this PR gets it some visibility and makes it easier for other to solve this problem.

This allows you to do:
```js
$('.typeahead').typeahead({
triggerCharacter: '@',
triggerRegex: /^@\w*$/,
local: ['lukekarrys', 'jharding', 'timtrueman']
});
```
And typeahead will only try to match the dataset as long as it comes after the `triggerCharacter` and matches the `triggerRegex`.