'''txt = "But in any event, (not all) Christians believe in the same theology, such as the one Latter-day Saints believe in. (They will cry "heresy" and other accusations of "perverting" the doctrines of the Bible, while they themselves believe in a myriad of interpretations, as found in their catechisms and various do-it-yourself Bible-study manuals)
As for me, I have a personal conviction that the pre-existance scenario as explained above, is most in harmony with Biblical doctrine, some Dead Sea Scroll books, the pseudographion, other sources, and last but not least, modern-day revelation on the subject." '''
I want to match (not all) and (They ...manuals). But whatever i try i am fetching either the second substring or the first. I want to fetch both the substrings. i.e. all the substrings within paranthesis Can someone help me out on this.??
Parenthesis in regular expressions are used to indicate groups. If you want to match them literally, you must 'escape' them:
import re
found = re.findall(r'\(.*?\)', text)
print(found)
Outputs:
['(not all)', '(They will cry "heresy" and other accusations of "perverting" the doctrines of the Bible, while they themselves believe in a myriad of interpretations, as found in their catechisms and various do-it-yourself Bible-study manuals)']