【发布时间】:2023-02-09 01:13:42
【问题描述】:
我有一个文件,其中包含
人物:男
宠物:狗,猫,
人物:女
宠物:狗、猪
像这样有很多人的数据 我只想获取男性的数据。 我正在尝试匹配两条线。那是行不通的
while{[gets $fh line] > 0} {
if {[regexp {(person: male.*)\n(pets :.*)} $line match submatch]} {
puts $match
puts $submatch
}
}
【问题讨论】:
标签: regex tcl file-handling