Regex matches must be between another match

146 Views Asked by At

I would like to match different things, and add condition that these matches must be between specific boundaries,

This is the text

protocol SceneDisplayView {
    func displayEmailScreen()
    func displayPasswordScreen()
    func displayNameScreen()
}

What i did so far is find my matches, using this regex:

(?:^\s*func\s(display\w*)\(\)$)

This will end as the following : enter image description here

as seen here in the demo: https://regex101.com/r/IuQ7nO/1/

I'm trying to limit these matches that they must be between protocol ... { and closing bracket }

so that if there's any floating match outside of these boundaries, they would not show up, how could this be achieved with one regex ?

0

There are 0 best solutions below