pickachu Posted January 9, 2008 Share Posted January 9, 2008 How do I search a whole html for a tag which is <br><br>Generated Strings: 76&67&5&5&9&<br><br>Shift Factor: 15<br><br>? Then store the 76&67&58&5&9& inside a variable? Please I need help badly.. Quote Link to comment Share on other sites More sharing options...
Wuhtzu Posted January 9, 2008 Share Posted January 9, 2008 What is "a whole html" ? And we need more information about the format of the "generated strings".... do they have a specific length, consist only of specific characters, start and end in a specific manner or are they within a specific tag? Quote Link to comment Share on other sites More sharing options...
pickachu Posted January 10, 2008 Author Share Posted January 10, 2008 Oh sorry, the HTML tag did not show up on my original post.. Inside a whole html tag, contains all sorts of html tags but the string that i want to store inside a variable is inside <br><br>Generated String: 76&67&5&5&9&<br><br>Shift Factor: 15<br><br> [code] And note, That [code]<br><br> is use only on that line.. [/code][/code] Quote Link to comment Share on other sites More sharing options...
dsaba Posted January 10, 2008 Share Posted January 10, 2008 #1, #3 http://www.phpfreaks.com/forums/index.php/topic,176092.0.html Quote Link to comment Share on other sites More sharing options...
pickachu Posted January 10, 2008 Author Share Posted January 10, 2008 Oh sorry, The output should be variable a = 76&67&5&5&9&; variable b= 15 Quote Link to comment Share on other sites More sharing options...
dsaba Posted January 10, 2008 Share Posted January 10, 2008 ~<br><br>Generated String: ([^<]+)<br><br>Shift Factor: (\d*)<br><br>~ Matches what you want in the first 2 subgroups <?php $hay = '<br><br>Generated String: 76&67&5&5&9&<br><br>Shift Factor: 15<br><br> [.c.ode] And note, That [.co.de]<br><br>'; preg_match_all('~<br><br>Generated String: ([^<]+)<br><br>Shift Factor: (\d*)<br><br>~', $hay, $out); $a = $out[1][0]; $b = $out[2][0]; ?> Quote Link to comment 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.