Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Only matches when word acted on is the first? #4

patcon opened this Issue · 6 comments

4 participants


Not sure if this is a bug or not. We used to be able to say things before the word we wanted to act on, and now this doesn't work. For example:

Is this intentional?

Also, not familiar with "passive groups" (?:...) and how they work. Can we use a regex block and annotate it to explain some of this for others who are poking around?


We can update the regex to ^(.+)?(?:[\W\s]*)?(\+\+|\-\-)(?: (?:for|because|cause|cuz) (.+))?$ which would result in haha erin has 1 points (because hubot doesn't know the difference between haha erin and patrick connolly, we'd need to allow all characters.)

Passive groups require that the character group matches, but does not end up in the resulting matches in the javascript array. I agree that the regex is getting a little out of hand.


What about adding a toggle to only match single words if we choose? We are using this as a replacement for the karma command in #drupal channels on IRC, and multiple words is not something we want by default. As suggested elsewhere, allowing multiple words by quoting would cover that small number of cases where someone might want that (ex: "dogs with poofy tails"++)



I could see adding an option to match only single words (with multiple words needing to be quoted), but I don't think that should be the default.


Ok, cool! I'll work on this sometime :)

@therealklanni therealklanni referenced this issue from a commit in therealklanni/hubot-plusplus
@therealklanni therealklanni annotated regex, bro
Annotated the regex as suggested in #4

Is this a dupe of #2?


They're both regex, but I think different issues to sort out. One is about ignoring (no match), and the other about misattribution of the plus'ed word (mismatching). Not even sure whether both are current issues though :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.