Closed GoogleCodeExporter closed 9 years ago
Hello guillaumehanique,
This is pretty strange.
Could you try a subject like: 'hello -- now'
Also, your delimiter hasn't been changed from '--'?
Original comment by blairk...@gmail.com
on 3 Jul 2013 at 10:24
Thank you for your reply. Other subjects work just fine. (If the delimiter
had changed I wouldn't have received an error email). I think something is
wrong with the regexp that parses the subject.
Are there unit tests for gmail delay send? (Perhaps I can have a look).
Original comment by guillaum...@gmail.com
on 4 Jul 2013 at 5:00
I wish there were unit tests :-(
Google scripts API doesn't have a good unit test framework (I think somebody is
working on one now though).
The regex is here (for 0.7.7):
https://code.google.com/p/gmail-delay-send/source/browse/src/downloaded/GmailDel
aySend.js#420
A quick test seems to work:
(/-- [^--]/i).test("Test -- 2013-07-03 10:43")
Error case is here:
https://code.google.com/p/gmail-delay-send/source/browse/src/downloaded/GmailDel
aySend.js#108
Just a note about the delim.. If you require a label on your emails and an
email if found with that label but without the delimiter then you could get an
error email w/o the correct delim. Doesn't sound like that is the case, but
it's something to look out for.
Let me know whatcha find!
(BTW: Family just had a new baby so might be late in response) :-)
Original comment by blairk...@gmail.com
on 5 Jul 2013 at 9:19
Congratulations on your new baby! Boy or a girl?
*Problem Description*
I think I already see the problem.
DELAY_SEND_REGEX = new RegExp(DELIMITER+" [^"+DELIMITER+"]+$","i");
If the delimeter is "--", which is the default, then the regular expression
will be:
--[^--]+$
or, in plain English:
- two dashes
- followed by a character that is not *a dash or a dash* more than one time
- until the end of the string.
So if we parse "Test -- 2013-07-03 10:43":
- two dashes: check: --
- followed by a character that is not a dash or a dash more than one time:
(space)2013
- (the dash between 2013 and 07 IS a dash (or a dash), so this doesn't
match).
- followed by the end of a string: NO. "(space)2013" is followed by a dash,
not by the end of the string.
Or, in other words: indeed "Test -- 2013-07-03 10:43" does NOT match the
regular expression.
*Solutions*
1 is a workaround.
3 is the best solution, I think.
1. Simply change the delimiter.
Two underscores would fix it, I think.
2. Group the delimiter.
The reason why it fails now, is because "[^--]" means: the character cannot
be a dash and it cannot be a dash. So one dash also meets this criteria.
Without testing I think that if
DELAY_SEND_REGEX = new RegExp(DELIMITER+" [^"+DELIMITER+"]+$","i"); /* is
replaced with */
DELAY_SEND_REGEX = new RegExp(DELIMITER+" [^("+DELIMITER+"]+)$","i"); /* it
might also work. */
3. Just start matching from the delimiter to the end of the string
The whole idea of the delimiter is that you choose something that does not
normally appear in the text, or, in other words, that it only appears once.
If that is true, then there is no reason to check for characters that do
NOT match the delimiter. So instead of
DELAY_SEND_REGEX = new RegExp(DELIMITER+" [^"+DELIMITER+"]+$","i"); /* one
could have */
DELAY_SEND_REGEX = new RegExp(DELIMITER+" .+$","i"); /* I see no real
reason why to explicitly match till the end of the string so */
DELAY_SEND_REGEX = new RegExp(DELIMITER+" .+","i"); /* might also work. */
Original comment by guillaum...@gmail.com
on 5 Jul 2013 at 9:48
Ah.. I had forgotten the [] is a character class (eg. OR'ing)
Thanks for the work debugging!
Maybe I should have just mentioned this at the beginning, but there is a new
version of the script out which has a lot of bug fixes:
https://code.google.com/p/gmail-delay-send/wiki/GmailDelaySendTransition_8
If you wouldn't mind giving this version a shot I'm trying to faze out 0.7.7..
New version's regexs:
https://code.google.com/p/gmail-delay-send/source/browse/v2/src/Prefs#81 &&
https://code.google.com/p/gmail-delay-send/source/browse/v2/src/Prefs#89
BTW: Girl! :-)
-Blair
Original comment by blairk...@gmail.com
on 7 Jul 2013 at 2:02
Original issue reported on code.google.com by
guillaum...@gmail.com
on 3 Jul 2013 at 8:50