^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$
test this pattern on regexr: https://regexr.com/4inht
regex pattern to match RFC 2397 data URL
dataurl := "data:" [ mediatype ] [ ";base64" ] "," data mediatype := [ type "/" subtype ] *( ";" parameter ) data := *urlchar parameter := attribute "=" value
data:image/jpeg;base64,UEsDBBQAAAAI
data:image/jpeg;key=value;base64,UEsDBBQAAAAI
data:image/jpeg;key=value,UEsDBBQAAAAI
data:;base64;sdfgsdfgsdfasdfa=s,UEsDBBQAAAAI
data:,UEsDBBQAAAAI
Ok, thanks for the clarifications there 👍
My understanding was that parameters, as being part of [mediatype] had to be placed before the [";base64"] and after the [type"/"subtype] tokens if present, but I guess I was wrong.