Jump to content

Capturing A Repeated Group But Instead It Repeats A Captured Group


Brandon_R

Recommended Posts

Hello guys, i wrote a regex to capture a repeated group but instead it repeats the captured group only getting the last line matched.

 

I wanted it to match

 

_C0 Infinite LP (8000)

_L 0x110E6938 0x00001F40

_L 0x110E6940 0x00001F40

_L 0x110E6950 0x00001F40

_L 0x1162A528 0x00001F40

 

With name tags so after the PHP regex has run, codeTitle would contain the stuff after _C0 and codeAddresses would be an array with all the lines on the left such as 110E6938, 110E6940 etc and codeValues would be an array with all the stuff on the right. So far i have

 

((?P<gameCodes>(_C0\s(?P<codeName>.+)\r\n(_L\s0x(?P<codeAddress>[a-f0-9]{8})\s0x(?P<codeValue>[a-f0-9]{8})(?:\r\n)?)+)))+

 

but that doesn't work. It only gets the last line and sometimes it doesn't even do that :D can you guys help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.