Extract and save references - extra line spacing

The problem is here:

We’re trying to strip out the numbering from numbered citations, but there isn’t clear definition of when the numbering ends. As the code stands, the number could optionally end with a period, close parenthesis, closing square brace, plus 0 or more spaces. The “21” in “21st” matches this and is stripped.

Our regex here needs to consider this.

In your original question, is the “empty line” between references present in the actual data (as a blank reference), or is this just a matter spacing within the display?