I want to find a specific regex in a docx document. I installed python-docx
and I can find strings in my text. However, I want to use regular expressions.
So far my code is:
import re
from docx import Document
doc = Document('categoriemanzoni.docx')
match = re.search(r"\[(['prima']+(?!\S))", doc)
for paragraph in doc.paragraphs:
paragraph_text = paragraph.text
if match in paragraph.text:
print('ok')
To me, it seems also that it doesn't read all paragraphs. How to fix it?