How Can I match XX.Xx("$\bH.Pt#S V0&DJT-R&", gM)
this pattern in a string shown below, the only constant is XX. two arguments are random
XX.Xx("$\bH.Pt#S V0&DJT-R&", gM)
XX.Vx("\'\x40]\tFv9](H\x40J[)", F6)
[XX.Ux("gI\ny", sl), Ar, XX.Rx("\t|", pO), Jd, XX.kx("xW\n", CM), Wm, XX.wx("U\vyV", DO), jr, XX.Mx("U\vxW", GO), Zm, XX.tx("a{O", xO), Hm, XX.RV(Qk, Hl, Q0), Qd, XX.Nx("\t|", OM), Br, XX.zx("{I\v", vM), jd, XX.gx("U\vxS", W6), nm, XX.kV(Qk, UM, Q0), Bd, XX.rx("\t|", RM), Xm, XX.mx("V\r", kM), Id, XX.dx("J\t~", KY), Lm, XX.hx("xV\v", wN), Sd, XX.bx("xU\x00", d6), rd, XX.Cx("axK", BM), Wd, XX.qx("}~", h6), Zd, XX.sx("gI\b", b6), Hd, XX.Kx("xU", C6), Lh, XX.Wx("U\ry", q6), pm["fpValStr"], XX.wV(Qk, Ml, F0), vd, XX.Zx("sH", LN), jm, XX.Hx("{I\f", jM), Xh], Vh && (Wr.push(XX.nx("xT", XN), XX.Ax("", VN)), Th = j3(N3)), Wr.push(XX.Fx("J\nu", nY), Md), Kr = ph(j2, [Wr, A0]), Dh = Wr.join(Kr), qr(XX.Ex("9I\x00", TN).concat(Dh["slice"](N3, W0)));
https://regex101.com/r/Ui71E9/1
CodePudding user response:
(XX\.[A-Za-z]*\("([^"]*)",\s*([0-9A-Za-z]{2})\),\s*[0-9A-Za-z)] )
To capture multiple times
- run the regexp on the big string
- if no matches, break
- use the second and third capture groups as you like
- get the first capture group
- in the big string replace that capture group with an empty string
- do it again with the modified string
Old Answer
XX\.[A-Za-z]*\("(.*)",\s*([0-9A-Za-z]{2})\)
I included capture groups if your interested
I can explain it if you'd like
XX\.
The beginning is probably obvious.XX\.
- it's important to note that
.
in regex matches anything, however I assume you specifically want to get a period. Thus we escape it like\.
- it's important to note that
[A-Za-z]*
next we are matching any amount of characters from capital A to capital Z and lower case a and lowercase z. I assume that it will always be 2 characters but I'll let it slide for now\(
next we escape the open parenthesis because parenthesis represents a capture group"
next we look for a quotation mark(.*)"
next we capture anything intil we hit another quotation mark.- It's important to note that if the string has an escaped quotation mark, this regexp breaks. If you need an escaped quotation mark also I'll try to help you out
,
next we look for a comma\s*
after that we look for any amount of spaces. Could be zero, could be a hundred(0-9A-Za-z){2}
next we capture two characters that could be 0-9 A-Z and A-Z\)
finally we end with a parenthesis