I had a similar situation with a comma delimited text file that I was importing into a SQLite table. If the last item in the line is an empty string Regex cannot handle it well. Here is my workaround:
When I created the text file at the server level, I made sure to replace a null (empty) string with a string with 1 space in it like this: " " , in other words one space as a string to fool Regex, so it can parse it.