Brandon_R Posted January 7, 2011 Share Posted January 7, 2011 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 can you guys help? Quote Link to comment https://forums.phpfreaks.com/topic/223675-capturing-a-repeated-group-but-instead-it-repeats-a-captured-group/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.