I would use this regex:
greet([^
]|
+[^S
])*name
Here the strings greet
and name
are separated by characters that are not a linebreak ([^
]
) or, in the case, they must be eventually followed by a space that is not a linebreak ([^S
]
). In this way you ensure that name is in the same method of greet.
See demo.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…