       @outPorts.out.disconnect()
 
   matchPattern: ->
-    groups = @groups.slice(0, @pattern.length)
+    groups = @groups.slice(0, @patterns.length)
 
-    for p, i in @pattern
+    for p, i in @patterns
       return false unless groups[i]?.match(p)?
 
     return true


  constructor: ->
    @cache = new CacheStorage
    @pattern = []

    @inPorts =
      in: new noflo.Port

    @outPorts =
      out: new noflo.Port

    @inPorts.pattern.on "connect", =>
      @patterns = []

    @inPorts.pattern.on "data", (pattern) =>
      @patterns.push new RegExp pattern

    @inPorts.replacement.on "connect", =>
      @cache.connect()
