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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.