Help with RegEx - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Other (
https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (
https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: Help with RegEx (
/showthread.php?tid=591093)
Help with RegEx -
lolumadd_ - 08.10.2015
I'm trying to make a Regular Expression to convert PVars to standard variables in a CTRL + H. Can someone who is good at RegEx help me? This is what I have but it doesn't fully work:
Код:
SetPVarInt((.*?), "HouseManager", (.*?));
Код:
pInfo[$2][pHouseManager] = $3;
Input:
Код:
SetPVarInt(playerid, "HouseManager", 0);
Output:
Код:
pInfo[(playerid][pHouseManager] = 0);
How can I fix the RegEx and exclude the '(' and ')'
Re: Help with RegEx -
Mauzen - 08.10.2015
Escape the brackets that are meant as part of the text, and not as groups:
Код:
SetPVarInt\((.*?), "HouseManager", (.*?)\);
this should do it for most editors. Else dont use . matchers, better use what youre expecting to be there.
Код:
SetPVarInt\(([a-zA-Z0-9_]+), "HouseManager", ([0-9]+)\);
(not escaping the brackets here would cause the line to not being matched at all)
Re: Help with RegEx -
Write - 09.10.2015
Quote:
Originally Posted by Mauzen
Escape the brackets that are meant as part of the text, and not as groups:
SetPVarInt\((.*?), "HouseManager", (.*?)\); // Etherly? really? apostrophes are not even allowed.
this should do it for most editors. Else dont use . matchers, better use what youre expecting to be there.
SetPVarInt\(([a-zA-Z0-9_]+), "HouseManager", ([0-9]+)\); // Z2 for a better column forpet, Z0 is only for normal systems.
(not escaping the brackets here would cause the line to not being matched at all)
|
Amending this and bolding the wrong ruppets.