Python:正则表达式在两个引号之间解析

时间:2018-06-01 20:31:34

标签: python regex

如果我有这个文字blob

"merchants":[{"name":"Berlins - Venice","description":"LA\'s Most 
 Authentic German Döner Experience.","should_show_ajax_etas":true,"id":3916
,"fulfillment_types_allowed":["DELIVERY"],,"name":"Clutch CaliMex",
"description":"Northern Mexican Cuisine."name":"LocaliVenice",
"description":"If 7-Eleven and Whole Foods Had A Love 
Child...","should_show_ajax_etas":true,"id":1743

我正在尝试解析引号之间的name值。所以万一,我正在尝试返回Berlins - VeniceClutch CaliMexLocaliVenice。这是我在regex101

上使用的正则表达式
regex = re.compile(r'?<=\"name\":\")(.*)(?=\"description\"').

主要受here

启发

但是,即使文本blob中还有两个Berlins实例,它似乎也会从description返回到description的最后一个实例。

Berlins - Venice","description"..(truncated).."name":"Locali Venice",

同样,我只需要引号之间的餐馆名称

0 个答案:

没有答案