I'm having difficulty in putting together a regex pattern that separates out all caps words in the beginning of a paragraph with the rest of the paragraph.
text_example =
"""HERE IS SOME TEXT, AND HERE IS SOME MORE; AND ANOTHER START. There is a lot of text
that I am also interested in extracting and that will have a variety of Information,
symbols @#$^*&^ and even amounts such as $4,123,156 to be included as well."""
Suppose I have the above text. I want to capture HERE IS SOME TEXT, AND HERE IS SOME MORE; AND ANOTHER START. - a pattern of all caps words and punctuation at the start of a passage - and the remaining There is a lot of text that I am also interested in... - that is text with symbols, numbers, and some capital letters at the start of new sentences or for names etc.
I have the following pattern I've been working on and it isn't quite right
pattern = re.compile(r"([A-Z]+\s?[A-Z]+[^a-z0-9])(.*)")
passage_start = re.search(pattern, text).group(1)
passage_remaining = re.search(pattern, text).group(2)
print(passage_start)
print()
print(passage_remaining)
When running this, I get:
HERE IS
SOME TEXT, AND HERE IS SOME MORE; AND ANOTHER START. There is a lot of text that I
am also interested in extracting and that will have a variety of Information, symbols
@#$^*&^ and even amounts such as $4,123,156 to be included as well.
Would appreciate some help! Thanks