Regex LoadError:PCRE编译错误:Lookback断言不是固定长度
当我试图在julia中编写一个使用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_
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“(?)?