Test, validate and match regular expressions
Matches PEM-encoded key file header/footer lines, such as '-----BEGIN RSA PRIVATE KEY-----' or '---- END PUBLIC KEY ----'. It captures an optional algorithm/label (e.g., RSA, EC, OPENSSH, ENCRYPTED) and whether the key is PRIVATE or PUBLIC, while tolerating either a dash or space between the four dashes and the keyword. Useful in JavaScript for parsing, validating, or extracting PEM key blocks from certificates, SSH keys, and cryptographic material.