Test, validate and match regular expressions
This regex extracts a Certificate Signing Request (CSR) in PEM format from a text body that may contain both a CSR and a private key. It captures the entire CSR block including the BEGIN CERTIFICATE REQUEST and END CERTIFICATE REQUEST headers along with all content between them. Commonly used when processing responses from certificate authorities or key generation APIs.