Fix off-by-one issue in regexp handling when countElements(swiftString) != nsString.length.
Example case: countElements("\r\n") (length 1) != ("\r\n" as NSString).length (length 2).