AnthonyDiGirolamo/todotxt-machine

E-mail addresses being picked up as contexts

Closed this issue · 2 comments

Really like this, but one thing I've noticed the first time I used it is that I have some todo items with e-mail addresses in them, and they are getting picked up as contexts.

Maybe it's the regexp that is used, but you should be able to assume that either the context is at the start/end of the line, or if not, then it has to have a whitespace before it.

Taking a quick look, you have a regex which is :

_context_regex       = re.compile(r'\s*(@\S+)\s*')

This might work better as:

_context_regex       = re.compile(r'(?:^|\s+)(@\S+)(?:\s+|$)')

Possibly, \S is also too 'open' in that it should be \w, in that it's a character that makes up a word (specifically [a-zA-Z0-9_])?

Thanks for doing, this!

Hi Darren,

Thanks for catching this! I exposed it with a test and updated the regexes for projects and contexts. I agree \S might be too open but I'll leave it for now. Some folks might like to use odd characters in their projects/contexts.

No problem - I think the tool looks really good - been looking for
something like it for a while now... Just never got around to writing one
myself :(

On 8 November 2013 16:08, Anthony DiGirolamo notifications@github.comwrote:

Hi Darren,

Thanks for catching this! I exposed it with a test and updated the regexes
for projects and contexts. I agree \S might be too open but I'll leave it
for now. Some folks might like to use odd characters in their
projects/contexts.


Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-28074277
.