# cat /etc/ssh/sshd_config ... Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress :: ... X11Forwarding yes Port 10022
my nim code :
import nre import streams
let fh = newFileStream("/etc/ssh/sshd_config", fmRead)
var
fhContent: string = ""
if not fh.isNil:
fhContent = fh.readAll() let r = re"(?im)^[ t]*Ports+(d+)$"
for res in findAll(fhContent, r):
echo res.split()[1]
fh.close
output: 22 10022
How can I use group match?
