Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 提取“之间的任何和所有字符”&引用;使用大查询正则表达式_Regex_Google Bigquery - Fatal编程技术网

Regex 提取“之间的任何和所有字符”&引用;使用大查询正则表达式

Regex 提取“之间的任何和所有字符”&引用;使用大查询正则表达式,regex,google-bigquery,Regex,Google Bigquery,我只需要从这个较大的字符串中提取“Loc”:“CART”: hits_eventInfo_eventLabel = {"AV":6,"CV":1,"PV":1,"AS":"1,2,3,4","Loc":"CART","PN":"Supreme Lover's® - 12\" Medium","PS":"6716a12c-0067-4d72-b560-a0dbd1197185"} “Loc”将始终保持不变,“CART”所在的值可能会更改 我正在尝试以下sql: REGEXP_EXTRACT(hi

我只需要从这个较大的字符串中提取“Loc”:“CART”:

hits_eventInfo_eventLabel = {"AV":6,"CV":1,"PV":1,"AS":"1,2,3,4","Loc":"CART","PN":"Supreme Lover's® - 12\" Medium","PS":"6716a12c-0067-4d72-b560-a0dbd1197185"}
“Loc”将始终保持不变,“CART”所在的值可能会更改

我正在尝试以下sql:

REGEXP_EXTRACT(hits_eventInfo_eventLabel, '"Loc":".*",') as Recommendation_Location
但它返回的是从“Loc”之后开始的字符串的整个剩余部分

我在GoogleBigQuery中使用标准sql,并且已经查看了所有文档,但似乎不知道如何获取引号中的字符


任何帮助都将不胜感激,谢谢

下面是BigQuery标准SQL

而不是

REGEXP_EXTRACT(hits_eventInfo_eventLabel, '"Loc":".*",')   
返回

Row Recommendation_Location  
1   "Loc":"CART","PN":"Supreme Lover's® - 12" Medium",   
Row Recommendation_Location  
1   "Loc":"CART",    
使用

REGEXP_EXTRACT(hits_eventInfo_eventLabel, '"Loc":".*?",')   
返回

Row Recommendation_Location  
1   "Loc":"CART","PN":"Supreme Lover's® - 12" Medium",   
Row Recommendation_Location  
1   "Loc":"CART",    
正如您所看到的,唯一的区别是-您需要在regexp中添加额外的
字符