这里是我的文字:如何限制正则表达式来捕获小
"A popular resource for the Christian community in the Asheville area."
"I love the acting community in the Orange County area."
我想拍摄"Asheville"
和"Orange County"
。我怎样才能从最接近的"the"
到"area"
?
这里是我的正则表达式:
/the (.+?) area/
他们捕捉:
"Christian community in the Asheville"
"acting community in the Orange County"
这是否工作'/((?:(?!the)。)+?面积/'? [Demo](https://regex101.com/r/qWQ4aS/1/) – degant
'/ \ b(([AZ] [az] + \ s?)+ \ b)(?= area)/'可能是好。 –
有趣的问题。使用String和Enumerable方法找不到令人满意的解决方案。 –