Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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 LoadError:PCRE编译错误:Lookback断言不是固定长度_Regex_Julia_Pcre - Fatal编程技术网

Regex LoadError:PCRE编译错误:Lookback断言不是固定长度

Regex LoadError:PCRE编译错误:Lookback断言不是固定长度,regex,julia,pcre,Regex,Julia,Pcre,当我试图在julia中编写一个使用lookback模式的解析器时,它抛出一个PCRE编译错误 function parser(str::String) a = match(r"^[a-zA-Z]*_[0-9]", str) b = match(r"(?<=[a-zA-Z]*_[0-9]_)[a-zA-Z]", str) a.match, b.match end parser("Block_1_Fertilized_

当我试图在julia中编写一个使用lookback模式的解析器时,它抛出一个
PCRE编译错误

function parser(str::String)
    a = match(r"^[a-zA-Z]*_[0-9]", str)
    b = match(r"(?<=[a-zA-Z]*_[0-9]_)[a-zA-Z]", str)
    a.match, b.match
end

parser("Block_1_Fertilized_station_C_position_23 KA1F.C.23")
# LoadError: PCRE compilation error: lookbehind assertion is not fixed length at offset 0
函数解析器(str::String) a=匹配(r“^[a-zA-Z]*.[0-9]”,str)
b=match(r)(?Julia使用Perl兼容的正则表达式(pcre),如中所述:

lookback的每个顶级分支必须具有固定的长度

这意味着您不能在lookback模式中使用像
*
+
这样的运算符

因此,您必须找出一种不使用它们的模式

function parser(str::String)
    a = match(r"^[a-zA-Z]*_[0-9]", str)
    b = match(r"(?<=_[0-9]_)[a-zA-Z]*", str)
    a.match, b.match
end

parser("Block_1_Fertilized_station_C_position_23 KA1F.C.23")
# ("Block_1", "Fertilized")
函数解析器(str::String) a=匹配(r“^[a-zA-Z]*.[0-9]”,str) b=匹配(r“(?)?