编写TCL脚本以匹配两个关键词之间的所有内容
示例:
X509v3 Extended Key Usage:
1.2.3.4, 1.3.6.1.4.1.311.4, 1.1.1.1, 234.432.1.36.4564.345
55.55.55.55, 66.66.66.66, 1234.5443.123.321.12.332.231.1
X509v3 Subject Key Identifier:
我希望能够获得扩展密钥用法和主题密钥标识符之间的所有信息。
1.2.3.4, 1.3.6.1.4.1.311.4, 1.1.1.1, 234.432.1.36.4564.345
55.55.55.55, 66.66.66.66, 1234.5443.123.321.12.332.231.1
我尝试过但没有成功:
set content [regexp {(?=<Extended Key Usage)(?s)(.*)(?=X509)} $ext match]
.
set content [regexp {\y(Extended Key Usage)(.*)(X509)\y} $ext match]
答案 0 :(得分:1)
regexp -linestop {Extended Key Usage:\s.*[\r\n]+((?:.|[\r\n])*?)(?=\s*X509v3 Subject Key Identifier:)} $subject regexmatch result
试试这个。结果在捕获组1中捕获。在TCL ARE http://wiki.tcl.tk/461
中支持不的Lookbehind