https://gitlab.com/sdalu/ssh-publickey/
AUTHORIZED_KEY_REGEX =
/(?: (?<directives>(?:[!-~]|\s(?=.*"))+) \s+ )? # Options
(?<type> [a-z0-9_-]+) \s+ # Type
(?<key> [A-Za-z0-9+\/]+=*) # Key
(?:\s+ (?<comment>.*?) \s* )? # Comments
/x
PUBKEY_OPENSSH_REGEX =
/ (?<type> [a-z0-9_-]+) \s+ # Type
(?<key> [A-Za-z0-9+\/]+=*) # Key
(?:\s+ (?<comment>.*?) \s* )? # Comments
/x
PUBKEY_RFC4716_REGEX =
/----\sBEGIN\sSSH2\sPUBLIC\sKEY\s----\R
(?<tags> (?:[^:\p{Space}\p{Cntrl}]{1,64} # Tags
\s*:\s*
(?:[^\\\r\n]*\\\R)* [^\\\r\n]+\R)*)
(?<key> (?:[A-Za-z0-9+\/]+\R)* # Key
[A-Za-z0-9+\/]+=*\R)
----\sEND\sSSH2\sPUBLIC\sKEY\s----
/xmu