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.. Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/ 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? Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/#findComment-434743 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] Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/#findComment-435157 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 Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/#findComment-435209 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 Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/#findComment-435423 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]; ?> Link to comment https://forums.phpfreaks.com/topic/85198-how-do-i/#findComment-435447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.