Andrei Zhamoida Andrei Zhamoida - 4 months ago 11
Javascript Question

How to get base64 code from css rule

I've got a string

'url(data:image/png;base64,iVBORw0K...GgoA)'
.

I need to invoke only base64 data from it. In output i'd like to see something like this
['iVBORw0K...GgoA']
.

Could anyone help me with creating a correct RegExp expression?

Thanks in advance.

Answer
.*base64,(\w+)\)$

If you get group 1 from the regex, you will get the base64 data you want.