I have the following text:
"
In the Matter of
XYZ-ABCD
Respondent.
"
Stashed away at some part of a pdf file. I am only interested in capturing the XYZ-ABCD part but apparently the regex I am using in python is not capturing the pattern correctly.
The piece of text I am interested in capturing can appear anywhere within the PDF and I am using the following pattern:
pat = "^\n+In the Matter of\n+(\s+\w+\s*)\n+
(Respondent\.|Respondents\.)\s+$"
This is the regex code I am using to capture
str = re.match(pat,input_str)
Obviously, I have included the \n to take care of the multiple lines,
However, I don't seem to be getting any matches and don't seem to see what I am missing in my pattern that has not included. This also includes partial matches which I don't seem to be getting.
re.MULTILINEat the end of your regex call? For that matter, can you show us the actual regex call you're currently trying to use (that is, the code involved in this question)?thiswhat you're looking for ?, your\s+should be\s*i.e(\s*\w+\s*)\r\nfor new lines. Can you break down your regex bit by bit until it does give a match? Then you should be able to tell us the exact regex character that is giving issues (or maybe the answer will become obvious to you).\wtry[-\w]and see if that helps.