regex removes the first charcter from the python group

You could use a lookahead instead to do the check and omit the capture group as you want the match only.

You can omit {1} and as there is a space at the end of the text, you can assert either \s*[A-Z1-9] or \s*$ to also match the last line.

[A-Z1-9].+?\.(?=\s*(?:[A-Z1-9]|$))

Regex demo

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top