I have the following string
... of 7th July 2019 , signed by the District Director of the National Service of ENCAC.
I wish to find
the National Service of ENCAC
I have this regular expression to search from "signed by" , but I would like it to search from the first "of" that follows "signed by"
(?<=signed by)(.*)(?=\.)
Thank you very much in advance for your help.
CodePudding user response:
You could match until the first occurrence of of
after signed by instead of looking back with a lookbehind, then use a capture group and match the trailing dot.
\bsigned by\b.*?\bof\b\s([^.]*)\.
If there can also not be a dot in between:
\bsigned by\b[^.]*?\bof\b\s([^.]*)\.