Brandon_R Posted April 12, 2011 Share Posted April 12, 2011 I created a regex to match psp codes from full to basic #!!999999999 Monies 0x00000000 0x00000000 ;this is a comment 0x00000000 0x00000000 ; Mod this ;mod this #Hello 0x00000000 0x00000000 Here it is (#!*.+[\r\n]*(??:;.+[\r\n]*)*(?:0x[a-f0-9]{8}\s0x[a-f0-9]{1,8}(?:\s*;.+)*[\r\n]*)*)+) Can someone show me where i went wrong? Im pretty sure it's the newline as it checks for \r\n but im pertty sure on html pages its <br /> but still not positive. A Code can have one title and infinitly* many code lines followed by comment lines Quote Link to comment https://forums.phpfreaks.com/topic/233544-complex-regex/ Share on other sites More sharing options...
requinix Posted April 12, 2011 Share Posted April 12, 2011 Given that input, what output are you trying to get? Spoiler: if you want the hex values sans any comments, you can't do it with one regex. It'll take at least two: one to grab the entire block of text, and one to remove comments and extra whitespace. Quote Link to comment https://forums.phpfreaks.com/topic/233544-complex-regex/#findComment-1200896 Share on other sites More sharing options...
salathe Posted April 13, 2011 Share Posted April 13, 2011 So you just want to match any 0x???????? (where ? is a hexadecimal digit) numbers that aren't within comment lines? Quote Link to comment https://forums.phpfreaks.com/topic/233544-complex-regex/#findComment-1201025 Share on other sites More sharing options...
Brandon_R Posted April 14, 2011 Author Share Posted April 14, 2011 I actually want to match the entire psp code from an html page. Say we have a page with html such as title, head, meta, content etc. I want it to pull those psp codes from the page and hopefully into an array, one code per array element. It matches the code some times and other times it just doesn't get a match. Quote Link to comment https://forums.phpfreaks.com/topic/233544-complex-regex/#findComment-1201424 Share on other sites More sharing options...
salathe Posted April 14, 2011 Share Posted April 14, 2011 Okay, well that didn't help at all. First you're changing the scope of the question entirely (by dealing with HTML documents) and secondly, no new information regarding what you've been trying, how they've been failing, etc.. How about showing us where you're at at the moment and how that does not do what you want it to do? Quote Link to comment https://forums.phpfreaks.com/topic/233544-complex-regex/#findComment-1201495 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.