Owner
Owner: ABC
Address: XYZ
Information
This is the pattern I am trying to Match. I want to Match the Details between Owner and Information but excluding the titles using the Regex like,
(?<=(\s*Owner))(.|\n)*?(?=\s*Information)
When I try to append ^
and $
to be more accurate, it is not matching.
(?<=(/^\s*Owner))(.|\n)*?(?=\s*Information/$)
Could you pls help me in this?
You're not giving enough detail. Since your first expression is working I assume you are using
Singleline
mode.My next assumption is, this string is only part of a larger string.
^
is matching the start of the string by default$
is matching the end of the string by default.Now, since your string contains stuff before and ahead, you need to change this default behaviour:
With the modifier
Multiline
,^
matches the start of a row and$
the end of a row. See the documentation for more details.So, your regex should look something like this: