bugfix: ngx.re.gsub swallowed the character after a 0-width match that happens to be the last match

ngx.re.gsub() will mistakenly swallow the character when 0-width match that happens to be the last match. 

To reproduce:
```
newstr, n, err = ngx.re.gsub('TestCase', '^ *', '', '')                                                                                                                                     
ngx.say(newstr)
```

Result: 
```
estCase
```