문제

I have a code written in PAWN for SA-MP, I sorted this code by several preg_replace calls with PHP and this is the semi-final code.

Final step is to remove the third parameter (They're Z-coordinates) with preg_replace which is float. like this:

SILLY4 = GangZoneCreate(-2178.69, -599.884, -0.00012207, -1794.92, -324.114);

to

SILLY4 = GangZoneCreate(-2178.69, -599.884, -1794.92, -324.114);
도움이 되었습니까?

해결책

This regex should do what you want: it removes the third parameter in the code.

$result = preg_replace('/(?m)^([^=]+= GangZoneCreate\(([^,]+,){2})(?2)((?2)[^)]+\);)$/', '\1\3', $subject);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top