itil_kuda Posted April 18, 2013 Share Posted April 18, 2013 im using file_get_content to parse site and here some html appear Version 1.1 is out and has a huge speed increase almost 7 times faster than version 1.0.1. I have pretty much removed the rate limit because it takes only about 17 ms on my server. If anyone is up to it you can I think theoretically get it about 25% faster. This is because there are only 1,296 unique expansions (from number 20 on) for reversing 16 characters and 7,776 unique expansions (from number 21 on) for reversing 20 characters. I'm doing 36,864 and 1,179,648 expansions for reversing 16 and 20 characters respectively. Note that you still need to do 12-ish reversing steps per attempt (32 ^ 4 and 32 ^ 5 for reversing 16 and 20 characters respectively).[code=auto:0]13c5e209f938eb123026e88a96b628f70db8c792:746573:tescrack time: 7.39 ms[/code]can anyone help me how to print only "13c5e209f938eb123026e88a96b628f70db8c792:746573:tes" or "tes" using preg_match? Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/ Share on other sites More sharing options...
requinix Posted April 18, 2013 Share Posted April 18, 2013 Don't use regular expressions in the first place. Use DOMDocument or some other HTML parser to navigate to the place that has that data. Which is hard to help with because I don't know what the HTML is. Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1425643 Share on other sites More sharing options...
Psycho Posted April 18, 2013 Share Posted April 18, 2013 Don't use regular expressions in the first place. Use DOMDocument or some other HTML parser to navigate to the place that has that data. Which is hard to help with because I don't know what the HTML is. Even with a DOM parser, I think you're still going to end up with the string he showed above. At that point, you need to find the text within [code=auto:0]13c5e209f938eb123026e88a96b628f70db8c792:746573:tescrack time: 7.39 ms[/code] Assuming those CODE tags are in the content and not a forum error, and If those "tags" are not variable (always the same), then you can use string functions to extract that text - otherwise RegEx is probably the solution. Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1425649 Share on other sites More sharing options...
Psycho Posted April 18, 2013 Share Posted April 18, 2013 Assuming that: 1. The only variability in the opening CODE tag is the number 3: The text in the CODE tags will always have two colons and you want everything up tot he first three characters after the 2nd colon preg_match("#\[code=auto:\d\]([^\:]*:[^\:]*:.{3})#is", $input, $match); echo $match[0]; Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1425658 Share on other sites More sharing options...
Psycho Posted April 18, 2013 Share Posted April 18, 2013 Correction to the code I provided. The value you want will be in $match[1] Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1425681 Share on other sites More sharing options...
kipling19 Posted April 24, 2013 Share Posted April 24, 2013 preg_match('[code=auto:0](.*?)crack time:.*?[/code]',$data,$match); Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1426257 Share on other sites More sharing options...
Psycho Posted April 24, 2013 Share Posted April 24, 2013 preg_match('[code=auto:0](.*?)crack time:.*?[/code]',$data,$match); You know that won't work, right? Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1426341 Share on other sites More sharing options...
kipling19 Posted May 7, 2013 Share Posted May 7, 2013 this would work only forgot to escape the square brackets with \ (backslash) preg_match('%\ (.*?)crack time:.*?\[/code\]%s',$data,$match); $match[1] should give the required value. Quote Link to comment https://forums.phpfreaks.com/topic/277104-preg_match-help-for-beginner/#findComment-1428803 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.