Actually you don't need to write your own tokenizer.
The 'simple' tokenizer allows the delimiters to be customized, but it's an undocumented feature.
Create your FTS table as follows, and SQLite will tokenize on ' ' (space) and '#' (hash) characters only:
CREATE VIRTUAL TABLE documents USING fts4(title, content, tokenize=simple '' '# ');
There was a discussion on the SQLite mailing list about this feature in 2012 here.
The source code in SQLite which supports this feature is here.
Quote from the mailing list regarding its lack of documentation:
"Likely the reason is that we forgot that this feature even exists.
It seems to have existed in the simple tokenizer, unchanged, since the
original introduction of FTS1 back in 2006."
Quote regarding whether it's safe to use the feature:
"But it has been in the code for so long now that we dare not change
it for fear of breaking long-established programs."
...however it was also mentioned that the feature is not likely to have been tested thoroughly.
I have just emailed the SQLite users mailing list, asking if this feature can be documented.
Update: One thing I'd add is that we found that if characters such as '*' or '-' are configured as delimiters like this, then they would also be stripped out of the FTS MATCH clause in queries. So while this works fine for '.' etc., it can't be used for characters which are also special characters in FTS MATCH.