我正在使用正则表达式从弯曲括号(或"括号")中提取数据a,b,(a,b)如下所示从中提取.我有一个文件,其中每一行都会像
this is the range of values (a1,b1) and [b1|a1]
this is the range of values (a2,b2) and [b2|a2]
this is the range of values (a3,b3) and [b3|a3]
Run Code Online (Sandbox Code Playgroud)
我使用下面的字符串来提取a1,b1,a2,b2等...
@numbers = $_ =~ /\((.*),(.*)\)/
Run Code Online (Sandbox Code Playgroud)
但是,如果我想从方括号中提取数据[],我该怎么办?例如
this is the range of values (a1,b1) and [b1|a1]
this is the range of values (a1,b1) and [b2|a2]
Run Code Online (Sandbox Code Playgroud)
我需要提取/匹配方括号中的数据而不是曲线括号.