A general output from GiNaC (https://www.ginac.de/) of harmonic polylogarithms is H(a,b,c...,x). We want to convert it to Mathematica format (https://www.physik.uzh.ch/data/HPL/) HPL[{a,b,c...},x].
Note: we need "a general string expression" for the "a,b,c..." in H(a,b,c...,x) as we have to deal with a lot of Hs, for example, converting:
H(2,2,x),H(2,1,x),H(2,1,2,x),H(1,2,3,4,x),H(1,2,3,4,5,x) to
HPL[{2,2},x],HPL[{1,2},x],HPL[{1,2,3},x],HPL[{1,2,3,4},x],HPL[{1,2,3,4,5},x]
StringCases["H(2,2,x),H(2,1,x),H(2,1,2,x),H(1,2,3,4,x),H(1,2,3,4,5,x)", RegularExpression["H\\(([\\w,]+)\\)?"] :> With[{res = ToExpression /@ StringSplit["$1", ","]}, HPL[Most[res], Last[res]]]]work for you? $\endgroup$