/\-\-\-\-\-BEGIN ENCRYPTED PRIVATE KEY\-\-\-\-\-(.*?)\-\-\-\-\-END ENCRYPTED PRIVATE KEY\-\-\-\-\-/ will reliably match and captureat least it will reliably compile. But . doesn't match \n unless you have the /s option for your regex. You were just one character away from code that actually works.
In reply to Re^2:regex for identifying encrypted text
by Eily
in thread regex for identifying encrypted text
by skendric
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |