文字为-"http://en.wikipedia.org/wiki/"The_Above_Ground_Sound"_of_Jake_Holmes":hey
。我需要正则表达式来获取http://en.wikipedia.org/wiki/"The_Above_Ground_Sound"_of_Jake_Holmes
。我试着写\"(.*?)\"
但是因为引号被嵌套而失败了。我需要最后一次出现"在最后的结尾部分。
我认为我需要消极的预测解决方案,但不确定。
答案 0 :(得分:5)
"(.*)"
这会抓住两个双引号之间的所有内容,并以贪婪的方式抓取它。这意味着它将在两个引号之间尝试匹配尽可能多的文本。
答案 1 :(得分:3)
实际上OP根据他的要求需要的是:
(?<=").*(?=")
# match only the contents without the external double quotes "..." ->
# http://en.wikipedia.org/wiki/"The_Above_Ground_Sound"_of_Jake_Holmes