Ask Your Question
2

What is the regular expression to remove the starting and ending parts from a certificate PEM string?

asked 2021-06-29 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-07-30 11:00:00 +0000

huitzilopochtli gravatar image

The regular expression to remove the starting and ending parts from a certificate PEM string would be:

/-----BEGIN CERTIFICATE-----(.*)-----END CERTIFICATE-----/s

This regular expression matches the starting string -----BEGIN CERTIFICATE-----, followed by any characters (captured using the parentheses and the .* expression), and then the ending string -----END CERTIFICATE-----. The s flag at the end of the regex allows the dot character to match newlines as well.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-06-29 11:00:00 +0000

Seen: 9 times

Last updated: Jul 30 '21