not sure why Regexp is expected to have anything for last_match, but added to the conditional to check for nil and that last_match[1] exists
    before attempting to use it
Merge pull request #242 from newcontext/issue_234

pull request for issue 234