Slide 22
Slide 22 text
respond: (regex, callback) ->
re = regex.toString().split("/")
re.shift() # remove empty first item
modifiers = re.pop() # pop off modifiers
...
pattern = re.join("/") # combine the pattern back again
if @alias
alias = @alias.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
newRegex = new RegExp("^(?:#{alias}[:,]?|#{@name}[:,]?) ... ", mod...)
else
newRegex = new RegExp("^#{@name}[:,]?\\s*(?:#{pattern})", mod...)
@logger.debug newRegex.toString()
@listeners.push new TextListener(@, newRegex, callback)
src/robot.coffee