Regex: String Contains multiple key words, capture the word between that

Hi All

I am working on text recognition, and there is a paragraph like this:

I, Amy Jones of 10 Bourke Street in the State of Victoria, hereby revoke all former wills and testamentary dispositions made by me…

I would like to capture the name, address and state, other words are in the same format, and I am trying to use regex, any idea how to do that? I am trying to use regex101, but still cannot make it.


Hi buddy

Will this format remain the same or will change dynamically
Cheers @jingwang0222

Hi buddy, remain the same, every string will have this format"I, xx of xxx in the state of xxx, hereby revoke all former wills"

Hi @jingwang0222,
I tried this for the name:
This for the address:
And the state:

Let me know if that works for you!

1 Like


This should work for the name and you can edit it as per your needs,
(?<=I, )(.*?)(?= of )

1 Like

Thanks a lot, it helps!

1 Like


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.