How to extract a string from Base64

I am trying to extract a mime type from a Base64 string… Regex is giving me a nose bleed.

Here’s how it looks:

I’d like to extract the image/jpeg which can, of course be different mime types…

So it makes sense to me to construct a regex expression that grabs anything between the : and the ; but I haven’t been able to make it work.

Any regex pros here? Or someone else with a better idea?

Hi there, @ian11… if I understand your post correctly, you can use two :split by operators to get what you need. Take the string and split by a colon and grab the last item… then split the resulting sting by a semi-colon and grab the first item. The result will be image/jpeg.



Hope this helps.


1 Like

That’s really great! Thanks for your help!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.